C# MySQL Connection

MySql.Data 6.9.8
PM> Install-Package MySql.Data

using MySql.Data.MySqlClient;

MySqlConnection Con = new MySqlConnection("Server=111.222.333.444; Port=3306; Database=grocery_db;Uid=root;Pwd=****");
Con.Open();
DataTable Table = new DataTable();
MySqlDataAdapter da = new MySqlDataAdapter("select id, name from contacts order by name",Con);
da.Fill(Table);
Con.Close();
Advertisements

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