Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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.

Posted

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

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...