1.从http://prdownloads.sourceforge.net/mysqldrivercs/MySQLDriverCS-n-EasyQueryTools-3.0.18.exe?download上下载MySQLDriverCS. 然后安装。
2.从安装目录中MySQLDriverCS.dll.添加到.net的组件 

 1 public void Connect_Net()
 2         {
 3             MySQLConnection mycn = new MySQLConnection(new MySQLConnectionString("localhost", "test", "root", "root", 3306).AsString);
 4             mycn.Open();
 5             MySQLCommand mycm = new MySQLCommand("SELECT * FROM user_message", mycn);
 6             MySQLDataReader reader = mycm.ExecuteReaderEx();
 7             try
 8             {
 9                 while (reader.Read())
10                 {
11                     str = reader.GetString(0) + reader.GetString(1);
12                     textBox2.AppendText(str);
13                 }
14             }
15             catch (Exception e)
16             {
17                 str = e.ToString();
18             }
19             reader.Close();
20             mycn.Close();
21         }

 

 

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2021-11-07
猜你喜欢
  • 2021-11-01
  • 2021-06-02
  • 2021-08-29
  • 2021-05-19
  • 2021-09-12
  • 2021-08-09
  • 2021-12-30
相关资源
相似解决方案