c# mysql 连接
MySQLConnection conn = null;
try
{
//MySQLConnection conn = new MySQLConnection(new MySQLConnectionString("myquest", "root", "amttgroup").AsString);
//实例化一个连接对象其中myquest为数据库名,root为数据库用户名,amttgroup为数据库密码
string connstr = "Data Source=MySQL;Password=root;User ID=root;Location=localhost";
conn = new MySQLConnection(constr);
conn.Open();
string query = "insert into test.dbtable values(10, 'disksidkfsdi', 'asdfaf', 'adsfasdf')";
string tmp = null;
MySQLCommand cmd = new MySQLCommand(query, conn);
for(int i = 0; i < 100000; i++)
{
cmd.ExecuteNonQuery();
}
cmd.Dispose();
conn.Close();
query = "select * from test.dbtable";
MySQLCommand cmd2 = new MySQLCommand(query, conn);
conn.Open();
//设定中文输出
MySQLCommand firstCmd = new MySQLCommand("set names gb2312", myConn);
firstCmd.ExecuteNonQuery();
MySQLDataReader reader = cmd2.ExecuteReaderEx();
while(reader.Read())
{
tmp = reader[0].ToString();
tmp = reader[1].ToString();
tmp = reader[2].ToString();
tmp = reader[3].ToString();
}
conn.Close();
query = "delete from test.dbtable";
MySQLCommand cmd3 = new MySQLCommand(query, conn);
conn.Open();
cmd3.ExecuteNonQuery();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
找茬脑洞的世界安卓版
休闲益智 下载
滑板英雄跑酷2手游
休闲益智 下载
披萨对对看下载
休闲益智 下载