C# 连接SQLSERVER2008 提示字符串''后的引号不完整
请看该连接字符串stringsql="'updateUsertablesetIsonlineflag=1whereUserName='"+stuName+"'";conn...
请看 该连接字符串
string sql = " ' update Usertable set Isonlineflag = 1 where UserName = ' " + stuName + " ' ";
conn.open();
SqlCommand cmd = new SqlCommand(sql,conn);
cmd.ExecuteNonQuery;
=======================================================
运行后提示:' update Usertable set Isonlineflag = 1 where UserName = ' " + stuName + ' 附件有语法错误,字符串‘ ’ 后的引号不完整
请问这个更新数据库的字符串到底丢失了什么符号,应在在哪里加上,才能完整? 展开
string sql = " ' update Usertable set Isonlineflag = 1 where UserName = ' " + stuName + " ' ";
conn.open();
SqlCommand cmd = new SqlCommand(sql,conn);
cmd.ExecuteNonQuery;
=======================================================
运行后提示:' update Usertable set Isonlineflag = 1 where UserName = ' " + stuName + ' 附件有语法错误,字符串‘ ’ 后的引号不完整
请问这个更新数据库的字符串到底丢失了什么符号,应在在哪里加上,才能完整? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询