您如何做更新声明?
我想使用此字符串theUserid更新UserID,并且我想在同一张表(图片)中使用fileuploadpaths(string)更新picturepath
OdbcCommand cmd = new OdbcCommand("UPDATE Pictures
SET ('" + theUserId + "','" + fileuploadpaths + "')
WHERE (UserID, picturepath)", cn);
不知道它是否
UPDATE Pictures
SET UserID = "+ theUserid +"
picturepath="+ fileuploadpaths +"
Where UserID = theUserid
picturepath = something already in my db?
编辑:
香港专业教育学院尝试这样做:
OdbcCommand cmd = new OdbcCommand("UPDATE Pictures SET picturepath ='" + fileuploadpaths + "' WHERE UserId = '" + theUserId + "')", cn);
但是我得到了错误:
您的SQL语法有误;检查与您的MySQL服务器版本相对应的手册,以在第1行的')'附近使用正确的语法
最佳答案
您可能想要这样的东西:
Update Pictures set picturepath = 'SomePath' where UserId = 'someUserId'