The following connection string works fine when I'm already logged in to a computer on our intranet:
"Server=sname;User ID=my.name;Database=DatabaseName;Trusted_Connection=true"
But from home, using a VPN connection into the intranet, the connection string fails because I'm obviously not "logged in".
I tried the obvious approach of adding my password:
"Server=sname;User ID=my.name;Database=DatabaseName;Password=secret;Trusted_Connection=true"
But this doesn't work. For future reference, I normally log on to a computer named
"Corp123" with a domain of "corpdomain".
I'm using SQL Server 2008, and Visual Studio 2010 to perform the connection using C#.
If source is my connection string, then the following is the code I use to log in from C#:
SqlConnection conn = new SqlConnection(source);
conn.Open();
SqlCommand cmd = new SqlCommand(@"StoredProcedureName", conn);
....
I appreciate any help anyone can give. I believe, most likely, that I have the permission to access the database as long as my connection string contains authentication information. But if it's likely I need special rights, please tell me what specific rights I need to ask for from my database adminsitrator. (My DBA's head pops off in response to vague security requests).
so, either your local windows machine login information must be added (as windows login) to the sql logins (however, I am not sure if the SQL Server can resolve - and hence trust - the remote login source... )
otherwise, you need indeed a classic sql login created in the sql logins, and THAT login/password shall be passed in the connection string, but you then need to remove the part "trusted_connection ..."