这条语句有什么错误啊?为什么老提示INSERT语法错误!

来源:百度知道 编辑:UC知道 时间:2024/06/08 12:18:03
OleDbCommand cmd1 = new OleDbCommand("insert into Board(Bname,Bmail,Btime,Btitle,Btext,image)values('" + this.labuname.Text + "','" + this.Label7.Text + "','" + this.labtime.Text + "','" + this.txttitle.Text + "','"+this.txttext.Text+"','" + imagetxt + "')", con);
cmd1.ExecuteNonQuery();

简直太让我郁闷啦!!

好密啊。。。

看不出什麼问题不过image在sql中是关键字你试试把image写成[image]看行不行

改为如下试试看:
OleDbCommand cmd1 = new OleDbCommand("insert into Board([Bname],[Bmail],[Btime],[Btitle],[Btext],[image])values('" + this.labuname.Text + "','" + this.Label7.Text + "','" + this.labtime.Text + "','" + this.txttitle.Text + "','"+this.txttext.Text+"','" + imagetxt + "')", con

imagetxt + "')",
这里错了
imagetxt + "'")",

把你的insert语句弄出来 放到查询分析器里试试么`

调试,得到sql语句后在查询分析器中执行
看看报什么错.
这样看着累