C#链接mysql数据库的2种包

来源:互联网 发布:工程结构优化设计基础 编辑:程序博客网 时间:2024/05/16 15:39

链接mysql数据库有2种dll包 不同的包用法不一样

MySql.Data.dll

这个包的用法:

using MySql.Data.MySqlClient;

private static string DB_CON_STR = "server=localhost;uid=root;pwd=991446;database=labmanger;Character Set=utf8";

 MySqlConnection conn = new MySqlConnection(DB_CON_STR);

MySqlCommand cmd = new MySqlCommand(strSql, conn);

 MySqlDataAdapter sda = new MySqlDataAdapter(strSql, conn);

MySQLDriverCS.dll

这个包的用法:

using MySQLDriverCS;

static string strCon = new MySQLConnectionString("localhost", "labmanger", "root", "123").AsString;

 MySQLConnection conn = new MySQLConnection(strCon);

MySQLCommand comm = new MySQLCommand(strSql, conn);

 MySQLDataAdapter sda = new MySQLDataAdapter(strSql, conn);