需要先下載mysqlnet.exe,安裝後引用CoreLab.MySQL.dll
基本語句
insert into `mis`.`users` ( name, age) values ( "ywm", 13)
select id, name, age from `mis`.`users` limit 0, 50
delete from `mis`.`users` where id > 8
update `mis`.`users` set name = "ywm1" where id = 13
連接字符串
MySqlConnection conn = new MySQLConnection("User Id=root;PassWord=sa;Host=localhost;Database=mis;");
conn.Open();
MySqlDataAdapter da = new MySQLDataAdapter("select id, name, age from `mis`.`users` ",conn);
DataSet ds = new DataSet();
da.Fill(ds,"users");
conn.Close();
DataGrid1.DataSource= ds;
DataGrid1.DataBind();