Mysql connector must be downloaded here -
http://www.mysql.com/products/connector/
after installing the connector the reference of
MySql.Data and other appropriate drivers must be added
to the application project.
after that the example codes shows how to use MySql db in
.net project -
using System;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace MySql
{
public partial class addstud : System.Web.UI.Page
{
MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlConnection conn;
MySqlDataReader reader;
protected void Page_Load(object sender, EventArgs e)
{
string connect = "Server=localhost;Database=petreg;user
id=root;password=mridul;";
string query = "SELECT id,breed from breeds";
conn = new MySql.Data.MySqlClient.MySqlConnection(connect);
using (cmd = new MySqlCommand(query, conn))
{
conn.Open();
breedDropDownList.DataSource = cmd.ExecuteReader();
breedDropDownList.DataValueField = "id";
breedDropDownList.DataTextField = "breed";
breedDropDownList.DataBind();
}
conn.Close();
}}}
in the above program a DropDownList is populated by MySql
database data.
more details - http://dev.mysql.com/