Network SQL connection

  • Thread starter Thread starter Trev
  • Start date Start date
T

Trev

Hi,

I have a connection to an SQL database on my local
machine for testing, i have now finished testing and
everything seems to be working fine but now when i change
the data source to a networked conputer it comes back
with an error that it can not find the SQL server.

I have tried giving it a path to one of my servers and
have also tried a path to my local computer name
\\computername

This is the code that i have now:

Private Function ConnectStringBuild() As String
Dim strConn As String

strConn &= "Data Source=(local);"
strConn &= "Initial Catalog=Northwind;"
strConn &= "User ID=sa"

Return strConn
End Function

And this is what i wanted to change it to.

Private Function ConnectStringBuild() As String
Dim strConn As String

strConn &= "Data Source=\\computername;"
strConn &= "Initial Catalog=Northwind;"
strConn &= "User ID=sa"

Return strConn
End Function

Is this possible or do i need something extra in there?
 
Just leave out the \\, all you need is the computer name
or you could just use the ip address.
 
Back
Top