Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Help With Vb And Mysql

forums forums SQLyog Using SQLyog Help With Vb And Mysql

  • This topic is empty.
Viewing 2 reply threads
  • Author
    Posts
    • #10430
      peterlaursen
      Participant

      A user asked this question by creating a new entry in the FAQ:

      “i have recently started using VB 2005 and i am using SQLyog to create the database. Can any one tell me what i need to do to connect VB 2005 to SQlyog database. All i have done so far is just created the DB and configured my ODBC driver from the control panel. when i try the connection in Vb it is asking for a .mdf file or something like that but i dont have one, any assistance will be appreciated”

      This will not be approved as a FAQ entry as it is not related to the use of SQLyog!

      But anyone knowing about VB and MySQL please answer this!  HERE!!

      and first reply from me:  you do not connect to SQLyog database.  Because there is no such thing!  There is a MySQL database!

    • #24453
      DonQuichote
      Member
      peterlaursen wrote on Jul 4 2007, 03:18 PM:
      A user asked this question by creating a new entry in the FAQ:

      “i have recently started using VB 2005 and i am using SQLyog to create the database. Can any one tell me what i need to do to connect VB 2005 to SQlyog database. All i have done so far is just created the DB and configured my ODBC driver from the control panel. when i try the connection in Vb it is asking for a .mdf file or something like that but i dont have one, any assistance will be appreciated”

      This will not be approved as a FAQ entry as it is not related to the use of SQLyog!

      But anyone knowing about VB and MySQL please answer this! HERE!!

      and first reply from me: you do not connect to SQLyog database. Because there is no such thing! There is a MySQL database!

      First, “VB” can be VB 6.0 or earlier or VB .NET. The difference is about as large as between c++ and java.

      Second, VB cannot connect to a database at all. This is a bit nit-picking, but you have to use an external library to do so. This can be either DAO (old but still the best for filesystem databases), ADO (newer) or ADO .NET (for VB .NET and the most current and heavyweight library).

      Naturally, they all use different methods of specifying a connection string. One thing to note is that for DAO, an ODBC connection string must start with “ODBC;”, while ADO connection strings will refuse to work if you do that.

      You can give the name of a system DSN (which may be the “configured” word in the above description) or just a full ODBC connection string. See http://www.connectionstrings.com/ for examples of those.

      Hope this is of any help.

    • #24454
      DonQuichote
      Member

      This example should provide enough info to get started:

      [codebox]Public Sub TestMySQL()

      Const CONNECTION_DETAILS = “DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=mysql;UID=YourUserName;PWD=YourPassw

      rd;OPTION=18475;”

      Dim objConnection As ADODB.Connection

      Set objConnection = New ADODB.Connection

      objConnection.Open CONNECTION_DETAILS

      With objConnection.Execute(“SHOW TABLES”)

      While Not .EOF()

      Debug.Print .Fields(0).Value

      .MoveNext

      Wend

      .Close

      End With

      objConnection.Close

      End Sub[/codebox]

      Have fun.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.