i connect to sql in windows form with this connection string: SqlConnection conn = new SqlConnection("Server =localhost;" + "Trusted_Connection=yes;" + "database=dataone; " + "connection timeout=30"); i want to connect it in windows service app but i cant . can u help me thanks in advance
SqlConnection conn = new SqlConnection("Server =localhost;Trusted_Connection=yes;database=dataone;connection timeout=30");
As for the issue, "I can't" is NEVER an adequate explanation of the issue. If it doesn't work as you expect then it does something else. What is that? If there's an exception then there's an error message. What is that? That will almost certainly tell you exactly what the issue is or point you in the right direction. My guess is that your service is running under a different user account than your Windows app and there is no SQL Server user with appropriate permissions that matches that user account.