执行SQL语句时出现错误 请各位看看错哪儿了,我看了一下午了,谢谢了
string gai = "update guandao set 制造日期 = '" + TextBox2.Text + "',安装日期 = '" + TextBox3.Text + "',管径 = '" + TextBox4.Text + "', 壁厚 = '" + TextBox5.Text + "',埋深 = '" + TextBox6.Text + "',腐蚀控制 = '" + TextBox7.Text + "',运行压力 = '" + TextBox8.Text + "' where 管道ID = '" + TextBox1.Text + "' ";
SqlCommand cmd = new SqlCommand(gai, con);
cmd.ExecuteNonQuery();
错误是:未处理的sqlexception‘,’附近有语法错误。
string gai = "update guandao set 制造日期 = '" + TextBox2.Text + "',安装日期 = '" + TextBox3.Text + "',管径 = '" + TextBox4.Text + "', 壁厚 = '" + TextBox5.Text + "',埋深 = '" + TextBox6.Text + "',腐蚀控制 = '" + TextBox7.Text + "',运行压力 = '" + TextBox8.Text + "' where 管道ID = '" + TextBox1.Text + "' ";
SqlCommand cmd = new SqlCommand(gai, con);
cmd.ExecuteNonQuery();
错误是:未处理的sqlexception‘,’附近有语法错误。
解决方案 »
- C#截取字符串的问题,急!!
- vs 2010打包winfrom安装程序
- 怎么将avi转成 gif 图片
- 关于一个转换类型的问题
- 如何用DBProviderFactory创建对象啊。
- [三个问题]有谁知道axWebBrowser1.Navigate()里面四个参数具体含义?如何实时获取正在浏览的页面标题?如何结束ASP.NET程序?
- webbrowser已经在webbrowser的DocumentCompleted事件中更改了所有的连接的target为_self可是连接还是在ie中打开
- 兼职程序员俱乐部招兼职程序员加盟
- 如何是window编程中的DataGrid中的单元在编辑中变为一个combobox下拉框让人选择??
- 用listview显示SQLite数据库中的记录,请问怎么知道选种的是哪条记录?
- 向PDF文档中添加图片
- 请问,HttpWebRequest如何执行js脚本?
这么写。。自己都难看。。用参数化sql语句吧不想改。。打个断点在string gai上看看生成的sql语句是什么样子的。。
sql语句参数化示例。。