.Net and MySQL: Example of using MySQL and .Net: A simple example of useing Connector/Net 5.2 to connect with MySQL from .Net

Follow this process:

  1. Download Connector/Net 5.2.
  2. Unzip the binaries. You will find 3-4 dlls along with other files.
  3. Add reference to mysql.data.dll, in your project.
  4. You can connect to MySQL throw code, as described below:

String conString = “server=server_name; user id=user_name;

password=password; database=db_name; pooling=false;”;

String queryString = “select * from employee;”;

using (MySqlConnection mySqlConnection = new MySqlConnection(conString))


using (MySqlDataAdapter adapter = new MySqlDataAdapter(queryString, mySqlConnection))


DataTable dt = new DataTable();


dataGridView1.DataSource = dt;



Published in: on July 27, 2009 at 8:39 pm  Leave a Comment  
Tags: , , , , , ,

The URI to TrackBack this entry is: https://indiandeve.wordpress.com/2009/07/27/net-and-mysql-example-of-using-mysql-and-net-a-simple-example-of-useing-connectornet-5-2-to-connect-with-mysql-from-net/trackback/

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: