Hello I am trying to use SQL Authentication to connect to a database .I am having extreme difficulties and my searches so far couldn't help me solve the problem.
I Enabled the SQL Authentication through SQL SERVER MANAGEMENT STUDIO and enabled sa and set a simple password for it.(under .\sqlexpress - i mean my server-name is ). Now I can Successfully log in to the database by sa and its password from SQL SERVER MANAGEMENT STUDIO but when i try to do so from my application it fails with this error message :
quote:Cannot open database "dbNegin" requested by the login. The login failed. Login failed for user 'sa'.
I need to say that i changed the database owner to sa as well, yet i get this error!! How can i solve this now? :( By the way this is the connection string used in my application to connect to the database :
My data base is attached by the way (its located in the address below )
quote: " D:\TestDb\Debug\dbNegin.mdf"
And this is the latest error log:
quote:2013-02-25 21:51:18.59 spid51 Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required. 2013-02-25 21:51:18.59 spid51 Using 'xpstar.dll' version '2007.100.1600' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required. 2013-02-25 21:51:20.80 spid51 Starting up database 'C:\USERS\FRIEND\DESKTOP\RELEASE\DBNEGIN.MDF'. 2013-02-25 21:51:21.33 spid51 Starting up database 'mytestdb'. 2013-02-25 21:51:21.60 spid51 Starting up database 'C:\USERS\FRIEND\DESKTOP\RELEASE\DBNEGIN.MDF'. 2013-02-25 21:51:35.60 Logon Error: 18456, Severity: 14, State: 38. 2013-02-25 21:51:35.60 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 2013-02-25 22:11:00.79 Server Server resumed execution after being idle 246 seconds: user activity awakened the server. This is an informational message only. No user action is required. 2013-02-25 22:11:00.97 spid51 Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required. 2013-02-25 22:11:01.04 spid51 Using 'xplog70.dll' version '2007.100.1600' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required. 2013-02-25 22:57:29.06 spid53 Starting up database 'C:\USERS\FRIEND\DESKTOP\RELEASE\DBNEGIN.MDF'. 2013-02-25 22:58:40.51 Logon Error: 18456, Severity: 14, State: 38. 2013-02-25 22:58:40.51 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 2013-02-25 23:07:09.86 Logon Error: 18456, Severity: 14, State: 38. 2013-02-25 23:07:09.86 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 2013-02-25 23:07:16.37 Logon Error: 18456, Severity: 14, State: 38. 2013-02-25 23:07:16.37 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
can you confirm the default database set for the logon and the explicit catalog defined in the connection string are available and the logon account has access rights to those 2 databases?
can you confirm the default database set for the logon and the explicit catalog defined in the connection string are available and the logon account has access rights to those 2 databases?
Thank you very much for your answer. The problem was all you have just mentioned :) The following thread solved my problem and here is the link for further references: