-
c# mysql 连接
- MySQLConnection conn = null;
- try
- {
-
-
- 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();
- }
-
相关阅读:
Ubuntu20.04 防火墙设置
Python——深度神经网络框架Pytorch安装与用法实例
Python——torch.unsqueeze
Go——vscode调试go语言 代码提示 代码跳转
Go——延迟函数 defer 用法举例 (转)
reactnative——win安装运行环境 创建运行demo程序
Go—— select case 用法
Python——tensor概念 Pytorch包 深度神经网络 (转)
Go—— go build o
MongoDB——副本集成员添加删除
-
原文地址:https://www.cnblogs.com/songtzu/p/2746983.html
Copyright © 2020-2023
润新知