ADO connection string for SQL Server

ADO connection string for SQL Server

Post by Emil » Sat, 02 Nov 2002 06:03:00



Hi.  I'm trying to connect to SQL Server from a VB app on
a different PC on the network.  Can't get the connection
string right.  Here's the scenario:  

There are two PC's networked together.  One of them (DMZ2)
contains SQL Server.  The other (DMZ1) contains the app
that calls SQL Server.  On DMZ2, the SQL Server Enterprise
Manager has several servers installed, each with its own
set of databases.  The database I'm trying to connect to
is called DHCDB1 and is contained in a server named
DMZServer.

This is the string I tried:

"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=DCHDB1;Data
Source=DMZServer"

Can anyone tell me what I'm doing wrong?

Thanks.
Emily

 
 
 

ADO connection string for SQL Server

Post by Bruce V » Sat, 02 Nov 2002 10:06:24


It sounds like you are using SQL Server 2000 and are trying to open a named
instance.

The following is from http://www.able-consulting.com/ADO_Conn.htm a great
source for ADO and more.

oConn.Open "Provider=sqloledb;" & _
           "Data Source=myServerName\myInstanceName;" & _
           "Initial Catalog=myDatabaseName;" & _
           "User Id=myUsername;" & _
           "Password=myPassword"

Bruce


Quote:> Hi.  I'm trying to connect to SQL Server from a VB app on
> a different PC on the network.  Can't get the connection
> string right.  Here's the scenario:

> There are two PC's networked together.  One of them (DMZ2)
> contains SQL Server.  The other (DMZ1) contains the app
> that calls SQL Server.  On DMZ2, the SQL Server Enterprise
> Manager has several servers installed, each with its own
> set of databases.  The database I'm trying to connect to
> is called DHCDB1 and is contained in a server named
> DMZServer.

> This is the string I tried:

> "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
> Security Info=False;Initial Catalog=DCHDB1;Data
> Source=DMZServer"

> Can anyone tell me what I'm doing wrong?

> Thanks.
> Emily