日期:2014-05-17  浏览次数:20523 次

sql语句,语法错误
数据库更新是有错误,  下断点之后基本锁定在这条sql语句上
                 sql = string.Format(@"update AnsPaper set Ans1="
                           + ansanswer[0].Text + ",Ans2="
                           + ansanswer[1].Text + ",Ans3="
                           + ansanswer[2].Text + ",Ans4="
                           + ansanswer[3].Text + ",Ans5="
                           + ansanswer[4].Text + ",Ans6="
                           + ansanswer[5].Text + " where PaperNum=" + papernum + "");
总是报错:','附近有语法错误

同样的,另一个类似的语句却能够执行,眼都看花了,也没找出错误
下面是正确的
                    sql = string.Format(@"update Paper set Ans1="
                          + ansnum[0] + ",Ans2="
                          + ansnum[1] + ",Ans3="
                          + ansnum[2] + ",Ans4="
                          + ansnum[3] + ",Ans5="
                          + ansnum[4] + ",Ans6="
                          + ansnum[5] + " where PaperNum=" + papernum + "");
sql语句?update sql 语句?update

------解决方案--------------------
sql = string.Format(@"update AnsPaper set Ans1='"
                           + ansanswer[0].Text + "',Ans2='"
                           + ansanswer[1].Text + "',Ans3='"
                      &