davidrobin Posted February 20, 2004 Posted February 20, 2004 I found an example of a connection string on GoDotnet http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/sqldtreader.aspx . But I am having difficulty understanding the connection string. With ADODB I would usully use the following connection string. Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Database ;Data Source=Server The connection string in the example is as follows Dim mySqlConnection as SqlConnection = new SqlConnection("server=(local)\VSdotNET;Trusted_Connection=yes;database=northwind") The bit I don't understand is server=(local)\VSdotNET How do I change this to point at the SQL server on the network when I am developing on my local machine? Quote
Administrators PlausiblyDamp Posted February 20, 2004 Administrators Posted February 20, 2004 server=(local) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
davidrobin Posted February 20, 2004 Author Posted February 20, 2004 How does it know what server to connect to. To me local means same machine. The server I want to connect to is a different server on the network. Following is the error I get. [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Source Error: Line 46: Line 47: 'Open the connection. Line 48: cn.Open() Line 49: Line 50: 'Use a variable to hold the SQL statement. Quote
Administrators PlausiblyDamp Posted February 20, 2004 Administrators Posted February 20, 2004 sorry missed that bit server=SERVERNAME Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
TheWizardofInt Posted February 20, 2004 Posted February 20, 2004 This one never fails for me: Dim SQLConn As SqlClient.SqlConnection SQLConn = New SqlClient.SqlConnection("Server=" & sServer & ";Database=" & _ sDatabase & ";uid=" & sSQLUser & ";pwd=" & sSQLPass & ";") I pass variables as they are named here to it Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
davidrobin Posted February 20, 2004 Author Posted February 20, 2004 The immediate problem with that is I want to use integrated security. I don't want to be passing passwords around. Quote
TheWizardofInt Posted February 20, 2004 Posted February 20, 2004 That is going to be dependent on the server settings, not the program, I believe. Have you tried configuring the SQL Server for Windows Authentication> Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.