I am fairly new to asp.net, I am trying to connect to a sql (mysql prefferably) database, it must be using C#. I have been searching all of yesterday and today, I cant figure out how. Could someone help me here (if this has been asked, please point me to a topic)

dude u need to create OdbcConnection.

using this object u can connect to any type of db such as (mssql, oracle, mysql, excel...)

dude i amnot sure abt the stability in using mysql with .net.


Do you have anything on it? just saying do an odbc connection doesnt help me.

It solves what to give it, but not on what to put it in. what use is a string with no command?

Does anyone know the answer to my question? it cant be that hard.

I am at my wits end trying to figure this out, does anyone know how to do this?

send me the string u r using and name of ur machine and database name also.

string connectString = @"Data Source=YOURPC\SQLEXPRESS;Initial Catalog=databasename;Integrated Security=True";
SqlConnection con = new SqlConnection(connectString);
string thesql= "select * from product where type_id=" + thistype + " and part_id="+thispart;
SqlCommand cmd = new SqlCommand(thesql, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
  string order = reader[2].ToString();
  Response.Write("Order is " + order+ "<br>");

how to connect database in c#? i can't do it. please help me . thanx