首页 > 数据库 > MySQL > 正文

MySQL基本语句和连接字符串

2024-07-24 12:57:36
字体:
来源:转载
供稿:网友

需要先下载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();


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表