RRinTetons
IS-IT--Management
(cross posted from the SQL Server Programming forum, sorry, but I honestly don't know which place to start and they're a little more active over there.)
And I don't know which one. Either I've got something wrong with SQL Server set up, my C# syntax or Vista's #%^&&*@#$ security model is getting in the way. (I got the Vista machine, I didn't choose it!)
In C# I can successfully set up a connection string as:
SqlConnection MyConnection = new SqlConnection("server=(local);database=pubs;Trusted_Connection=yes")
to connect to the pubs demo db on my local machine and all is well.
The production server I want to connect to is accessed remotely. I can connect to it with SSMS using server 'myserver.mydomain.com', myUserID 'myUserID', password 'myPassword' and default DB 'myDB'.
When I try to do it from C# with the connection string definition:
SqlConnection MyConnection = new SqlConnection("myserver.mydomain.com;database=myDB;UID=myUserID;PWD=myPassword")
I get back an error from the .NET Framework when the query tries to execute (the point at which the connection is actually opened for the first time. It's the generic:
"An error occurred while establishing a connection to the server..."
I'm guessing I've got something crossed up in the connection string, but I haven't found a good example of building the string for an external data source using SQL Server authentication.
?????
-
Richard Ray
Jackson Hole Mountain Resort
And I don't know which one. Either I've got something wrong with SQL Server set up, my C# syntax or Vista's #%^&&*@#$ security model is getting in the way. (I got the Vista machine, I didn't choose it!)
In C# I can successfully set up a connection string as:
SqlConnection MyConnection = new SqlConnection("server=(local);database=pubs;Trusted_Connection=yes")
to connect to the pubs demo db on my local machine and all is well.
The production server I want to connect to is accessed remotely. I can connect to it with SSMS using server 'myserver.mydomain.com', myUserID 'myUserID', password 'myPassword' and default DB 'myDB'.
When I try to do it from C# with the connection string definition:
SqlConnection MyConnection = new SqlConnection("myserver.mydomain.com;database=myDB;UID=myUserID;PWD=myPassword")
I get back an error from the .NET Framework when the query tries to execute (the point at which the connection is actually opened for the first time. It's the generic:
"An error occurred while establishing a connection to the server..."
I'm guessing I've got something crossed up in the connection string, but I haven't found a good example of building the string for an external data source using SQL Server authentication.
?????
-
Richard Ray
Jackson Hole Mountain Resort