String connetStr="server=127.0.0.1; Port=3306; User=root; Password=123456; The database=ss; ";
//server=127.0.0.1 localhost on behalf of the native, port to port the default is 3306 can not write a
MySqlConnection conn=new MySqlConnection (connetStr);
Try
{
conn.Open();//open channel, to establish a connection, may be abnormal, the use of the try catch statement
RichTextBox1. Text="successful connection";//set the Text property
//use the code here to add or delete the database to check change
String commandStr="insert into pifu (cdkey, name, a list) values (aaa, BBB, CCC)";
}
The catch (MySqlException ex)
{
//the Console. WriteLine (ex. Message);
RichTextBox1. Text="connection";//set the Text property
}
The finally
{
conn.Close();
}
I ask the last string commandStr="insert into pifu (cdkey, name, a list) values (aaa, BBB, CCC)";
I equal to a database table called pifu cdkey, name, list the three tables respectively inserted into the aaa, BBB, CCC wrote no effect, so short of what execute commands?