Beginner MySQL, if you want to use MySQL connector for connection, first download (http://dev.mysql.com/downloads/connector/net/5.1.html)
Reference DLL. Below is a simple testCode.
Using MySQL. Data. mysqlclient;
....
String _ strconnect ="Server = localhost; user id = snow; Password = snow; database = db_test";
Mysqlconnection myconn = New Mysqlconnection (_ strconnect );
Myconn. open ();
// Note that the parameters in Oracle and MSSQL are preceded by @, and MySQL must contain ?, I don't know why MySQL is specialized,
String _ squery ="Insert into myfirst (ID, name) values (? ID ,? Name)";
Mysqlcommand mycommand = New Mysqlcommand ();
Mycommand. Connection = Myconn;
Mycommand. commandtext = _ squery;
Mysqlparameter para1 = New Mysqlparameter ( " ? ID " , Dbtype. int32 ); // What should I do here? No.
Mysqlparameter para2 = New Mysqlparameter ( " ? Name " , Dbtype. String ); // What should I do here? No.
Para1.value = 5 ;
Para2.value = " Ddd " ;
Cmd. Parameters. Add (para1 );
Cmd. Parameters. Add (para2 );
Cmd. executenonquery ();