I have developed the windows service & in windows service used the SQL server database .
when i will start the computer my windows service get started but it will not connect to the SQL server .it display the following message
"Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\SYSTEM'."
I want to start my service when my computer starting.
how to establish the connection to SQL server database from windows service ?
Loading
vrushali katkadePosted Oct 3, 2011, 1:54 AM
i have write the database filed into the connection string & start the computer it display the message as above
Prabhu RajaPosted Oct 3, 2011, 1:22 AM
Server=.\\SQLExpress;AttachDbFilename=Path\\Databasefilename.mdf; Database=DatabaseName;Trusted_Connection=Yes;
-----------------------------------------------------------------------------------------------------------
If this post helps you, then marks as "Correct Answer"
Thank You
vrushali katkadePosted Oct 3, 2011, 12:03 AM
Prabhu RajaPosted Oct 1, 2011, 8:35 AM
Check your Connection String.
Data Source=Servername;Initial Catalog=Databasename;User Id=Username;Password=Password;
I case your database is file Based, then change database name as
Data Source=Servername;Initial Catalog=Databasename.mdf;User Id=Username;Password=Password;