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?
Thanks
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