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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB, ODBC, ADO and Provider String 1

Status
Not open for further replies.

petersJazz

Programmer
Jan 28, 2002
222
EU
How do I initialize a connection with ADO. I have tried this:

Private Sub Form_Load()
Dim objRs As ADODB.Recordset
Dim strSQL As String
Dim strConnStrTest As String
Set objRs = New ADODB.Recordset
strSQL = "SELECT u.wName, count(*) " & _
"FROM Users u, Bugs b " & _
"WHERE u.wName = 'Peter Karlsson'"
strConnStrTest = "Provider=MYSQL;" & _
"Data Source=Projektplatsen;"
objRs.Open strSQL, strConnStrTest, adOpenForwardOnly, _
adLockReadOnly, adCmdText
End Sub

This will give me: Run-time error '3706' Provider connot be found. It may not be properly installed.
 
First, create a ODBC DSN which points to your DB, with user and password. Install MyODBC if needed. We call it MysqlODBC, for instance.

Dim cnnConn as adodb.connection
Dim objRec as adodb.recordset
Set cnnConn = new adodb.connection
Set objRec = new adodb.recordset
cnnConn.connectionstring = "DSN=MysqlODBC"
objRec.open "SELECT ................"

... more or less.
You are using a provider which does not exist by default. You must install one (and pay, because I don't know one for GPL License). Use MyODBC. It works fine!
(note: if you find a free GPL provider for MySQL, please, notify me)

 
I forget it ..

cnnConn.open
objRec.open "SELECT ................", cnnConn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top