Hi, I am in the process of trying to use VB 2005 to connect to a MySQL DB . I have the data connection working between the program (VB 2005) and my MySQL server but now I need to make my code connect to it. I have never done a DB connection before, although, I do have a pretty good command of VB coding. Are there any good tutorials with code samples that might be helpful in this area or does anyone have some sample code I could look at so that I could understand how it is done? Thanks a ton!!!

there are hundreds of them -- just use google. Here are the ones from Microsoft

Imports System
Imports System.Data
Imports MySql.Data.MySqlClient

Module MySqlConnect

   Sub Main()
      Dim connString As String = "Database=Test;Data Source=localhost;User Id=root;Password=mypassword"

      Dim conn As New MySqlConnection(connString)

         Console.WriteLine("Connection Opened")

         Console.WriteLine("Connection Properties")
         Console.WriteLine("- ConnectionString : {0}", conn.ConnectionString)
         Console.WriteLine("- Database : {0}", conn.Database)
         Console.WriteLine("- DataSource : {0}", conn.DataSource)
         Console.WriteLine("- ServerVersion : {0}", conn.ServerVersion)
         Console.WriteLine("- State : {0}", conn.State)

      Catch ex As MySqlException
         ' Display error
         Console.WriteLine("Error: " & ex.ToString())
         ' Close Connection
         Console.WriteLine("Connection Closed")

      End Try

   End Sub

End Module

The definition of File Extension and the path of database is missing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.