|
-
Jan 31st, 2002, 07:05 PM
#1
Thread Starter
PowerPoster
Using MySQL with VB
I get the following error with parksie's example found here.

Where/how do I install an ODBC driver, and will I need it installed on any machine that uses the program? Oh yeah... I'm running windows 2000 professional.
Thanks
-Joey
-
Jan 31st, 2002, 07:20 PM
#2
PowerPoster
You have referenced MS ADO2.5 library yes??
Do you have the latest MDAC components?
2.7 is the latest!
later
b
-
Jan 31st, 2002, 07:31 PM
#3
Thread Starter
PowerPoster
I had 2.6, and now I have 2.7 since u told me that was the newest version, but I still get the same error. I just want to connect to a MySQL database and read some info from a table, then close the connection.
-
Jan 31st, 2002, 07:34 PM
#4
PowerPoster
SO you have referenced it though correct???
Post you connection code!
-
Jan 31st, 2002, 07:43 PM
#5
Thread Starter
PowerPoster
I don't even know how to connect!!! I don't do databases, especially not with VB. I have mySQL running for my website forums, but I want to connect to it with VB. For now I just want to connect to localhost, and I can change it later if I ever distribute the project. Yes I do have Microsoft ActiveX Data Objects 2.7 Library referenced in my project... now how do I connect?
Thanks Beacon for trying to help me.
-
Jan 31st, 2002, 07:50 PM
#6
PowerPoster
gimme 20mins!
not at vb computer!
-
Jan 31st, 2002, 08:30 PM
#7
PowerPoster
Ok midgetsbro have you read Karls tutorials on VB-World???
SQL server 7 quick start guide it's called!
Anyways this covers connections!
But in parksies example he has set up a function to deal with it:
VB Code:
Private Function GenConnectStr(sDatabase As String, sServer As String, sUser As String, sPass As String, sPort As String, sOpt As String, sStmt As String) As String
GenConnectStr = "DRIVER=MySQL;DB=" + sDatabase + ";SERVER=" + sServer + ";UID=" + sUser + ";PWD=" + sPass + ";PORT=" + sPort + ";OPTION=" + sOpt + ";STMT=" + sStmt + ";"
End Function
On uses it in the PopulateLV sub:
VB Code:
Dim ms As New Connection
ms.Open GenConnectStr(sDB, "192.168.0.1", "root", "jabber", "3306", "0", "")
Now is all that information correct???
Remember he is using ADO not DAO! So a few things it could be:
Change the following:
Dim ms As New ADODB.Connection '-adding in adodb.
Dim rst As New ADODB.Recordset 'the same
hows that?
-
Jan 31st, 2002, 08:59 PM
#8
Thread Starter
PowerPoster
Thanks beacon. I'll have to read Karl's tutorials before I post next time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|