Connecting MYSQL thru VB

mysql , vb6 India
  • 18 years ago

    how to connect MYSQL database through Visual Basic, its urgent.


    Thanx


    Bye

  • 18 years ago

    Use ADO.  Add a project reference to Microsoft OLE DB ActiveX Data Objects 1.0 Library.  Then, use this code:


    Code:

    Dim conn1 as ADODB.Connection
    Dim rst1 as ADODB.Recordset
    Dim SQLConnect as String
    Dim SQLSelect as String


    SQLConnect = <connectionstring>     ' I'm not sure what the MySQL Connection string is...just do a search for "MySQL ADO Connection String"


    Set conn1 = new ADODB.Connection


    conn1.ConnectionString = SQLConnect
    conn1.Open


    Set rst1 = conn1.Execute(SQLSelect)



    That should get you started on your way.  Sorry I couldn't be more specific, but I was just going off the top of my head.  Hopefully that helped you out a little bit.  Good luck!




Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“To iterate is human, to recurse divine” - L. Peter Deutsch