Thread: mysql vb6

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Canada
    Posts
    19
    Rep Power
    0

    Question mysql vb6


    Does anyone know where I can find an online primer on vb6 and mysql. I am a rookie with vb(so I don't know that much vb), I am more or less a php programmer.

    I am working with a call display application that log's all the incoming calls. All I need to do is connect to my database and then record the calls.

    This is very easily achieved with PHP... So far I have installed MyODBC 2.50 but I don't know how to test to see if it works in vb6...

    any help or guidance would be greatly appreciated..

    thanks in advance..
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    -
    Posts
    13
    Rep Power
    0
    Hi,
    Basically you need to create a DSN on your computer, than to create an ADODB Connection object and to connect using your DSN.
    Having your connection it has a method to execute a sql string.

    I hope this helps.
    Best regards
    Razvan
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Canada
    Posts
    19
    Rep Power
    0
    I have set up a dsn...but I am still unable to set up a connection...

    dsn ='mysql_dsn'
    server ='localhost'
    password =''
    user =''

    Could you help me with the next step... I am a rookie..I know once I setup a connection...I will be able to build my code from there..it's getting the initial connection that's killing me.

    thanks in advance
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Dim myRS As New ADODB.Recordset

    Set myRS = New ADODB.Recordset
    myRS.ActiveConnection = "Driver={MySQL}; server=; DB=; UID=; PWD="

    myRS.Open
    ...
    ...
    myRS.close

    Set myRS = Nothing
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Canada
    Posts
    19
    Rep Power
    0

    this worked for me


    Dim conn As New ADODB.Connection
    conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=mydatabase;UID=myid;PWD=mypassword;"

    The above code worked for ME!

    Damn, there is nothing worse than the first steps of learning something new....makes you feel real stupid...

    YIPPE...
  10. #6
  11. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    30
    One more small thing. The MySQL ODBC driver has a setting to "Don't Optimize Column Width". If you decide to use disconnected, client-side recordsets, not having this option set can cause problems. To set this programatically, you have to set Option = 1. Here's a couple of links to some other posts. It never hurts to have this option set, but trying to figure out why your program won't work when it isn't can be frustrating:

    VB/access talking to mysql

    MySQL and VB

IMN logo majestic logo threadwatch logo seochat tools logo