Click to See Complete Forum and Search --> : Error while connecting asp.net to mysql


vkdixit
11-20-2008, 05:19 AM
Hello!

I am using asp.net 2.0 (c#) with mysql 5.0 for my website. but i am facing a connection based problem overhere.




protected void Page_Load(object sender, EventArgs e)
{

con = new OdbcConnection("DRIVER={MySQL}; Port=3306; SERVER=myIP;DATABASE=abc;USER=abc;PASSWORD=abc; OPTION=3;");
cmd.Connection = con;

}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
cmd.CommandText = "select * from ttt";
dr = cmd.ExecuteReader();
Response.Write(dr["aa"].ToString());
Response.Write(dr["bb"].ToString());
dr.Close();
con.Close();
}






I am getting the following error:

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified



Please Help!!