How To Use MySql Connector Net

First we need to create a windows form  a project in Visual Studio you can choose from C# or VB.  Once we have a project we just need to right-click in reference then select Add Reference

Once we are in the Reference Manager window we just need to click Assemblies->Extensions then select MySQL.Data and MySql.Data.Entiry then click Ok button.


On our code we just need to create a ConnectionString “Server=[server ip];Port=[mysql port no];Database=[database name];Uid=[mysql username];Pwd=[mysql password];”

Here is a sample code for that will records from table [pl_make]

string _conStr = "Server=;Port=3306;Database=ddtrax;Uid=root;Pwd=password;";

MySqlConnection _con = new MySqlConnection(_conStr);
DataTable _table = new DataTable();
MySqlDataAdapter _adp = new MySqlDataAdapter("select * from pl_make", _con);

Dim  _conStr as String = "Server=;Port=3306;Database=ddtrax;Uid=root;Pwd=dd2015;"

Dim _con as MySqlConnection = new MySqlConnection(_conStr)
Dim _table as new DataTable()
Dim _adp as new MySqlDataAdapter("select * from pl_make", _con)

Liked it? Take a second to support denricdenise on Patreon!

You may also like...