Results 1 to 8 of 8

Thread: Using MySQL with VB

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125

    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
    <removed by admin>

  2. #2
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    You have referenced MS ADO2.5 library yes??

    Do you have the latest MDAC components?
    2.7 is the latest!

    later
    b

  3. #3

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    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.
    <removed by admin>

  4. #4
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    SO you have referenced it though correct???

    Post you connection code!

  5. #5

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    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.
    <removed by admin>

  6. #6
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    gimme 20mins!

    not at vb computer!

  7. #7
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    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:
    1. 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
    2.     GenConnectStr = "DRIVER=MySQL;DB=" + sDatabase + ";SERVER=" + sServer + ";UID=" + sUser + ";PWD=" + sPass + ";PORT=" + sPort + ";OPTION=" + sOpt + ";STMT=" + sStmt + ";"
    3. End Function

    On uses it in the PopulateLV sub:
    VB Code:
    1. Dim ms As New Connection
    2.     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?

  8. #8

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Thanks beacon. I'll have to read Karl's tutorials before I post next time.
    <removed by admin>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width