c#写注册模块为什么信息提交不到数据库中,老是出现keyword not supported,求大神帮忙

all1023 2016-03-23 07:19:23
string str = "sever=127.0.0.1;user ID=root;password=123456;database=caldb";
MySqlConnection con = new MySqlConnection(str);错误提示在这一运行就出现keyword not supported
con.Open();
string mysql = "insert into tb_peo(raterID,pas,name) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox4.Text + "',0)";
MySqlCommand cmd = new MySqlCommand(mysql, con); //创建执行
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("恭喜你注册成功", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
...全文
1166 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Justin-Liu 2016-03-24
  • 打赏
  • 举报
回复
醉了……
yaotomo 2016-03-24
  • 打赏
  • 举报
回复
连接字符串关键字写错,sql语句拼接时忘记添加引号,而且要插入3个字段但实际插入了4个字段
Sunny陈 2016-03-24
  • 打赏
  • 举报
回复
string mysql = "insert into tb_peo(raterID,pas,name) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox4.Text + "',0)"; 有问题吧?
tcmakebest 2016-03-24
  • 打赏
  • 举报
回复
sever ==> server database=caldb;server=127.0.0.1;user id=root;password=123456

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧