Source Code: VB.Net to MySQL Connection

freevbcode

This code is use to connect MySQL Database using VB.Net. Please follow this following steps below.

  1. Add a new Module, in my case I use “dbcon” as my filename.
  2. Add the “MySQL.Data” reference.
  3. Insert this code into your dbcon Module above class.
Imports MySql.Data.MySqlClient

4. Insert this code inside the dbcon Module Class.

Public conn As New MySqlConnection("Database= YOURDATABASE;" & _
                                       "Server= localhost;" & _
                                       "UserID= root; Password=YOURPASSWORD;")

 

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz