Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB4 Connection to SQL2000

Status
Not open for further replies.

luxcs

Technical User
Joined
Mar 23, 2004
Messages
8
Location
GB
Hopefully someone can help me here.

I'm trying to write a small VB4 program that connects to an SQL DB on another machine on the network.
I've managed to get another project (Excel VBA to connect to SQL via ADO) working fine. But cannot get this project to work.

Can anyone help me with some tips/pointers as to any extras/addins required or some code examples to get a connection and maybe even running the SQL.

VB4 doesn't like the code below (this is how it was done with VBA). It says "argument not optional" at the highlighted section. How can it be done with VB4?

Code:
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection

' Provide the connection string.
Dim strConn As String
'Use the SQL Server OLE DB Provider.
strConn = "PROVIDER=SQLOLEDB; DATA SOURCE=ops-serv;INITIAL CATALOG=testDB; INTEGRATED SECURITY=sspi;"

'Now open the connection.
cnPubs[COLOR=red][b].Open[/b][/color red]  strConn
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top