有人能帮我排错吗?关于vb里执行sql语句的
SqlStmt = "UPDATE Users SET password= ' " + Trim(newPw) + " 'WHERE password = ' " + Trim(Password) + " ' AND adminName = ' " + Trim(UserName) + " ' "
cnn.Execute SqlStmt
sqlstmt是string类型
执行后说UPDATE语句出错~晕~哪里有错啊
附我想执行的完整sql语句:
update users set password= 'bbb '
where password= 'aaa ' and adminName= 'admin '
[解决办法]
SqlStmt = "UPDATE Users SET password= ' " + Trim(newPw) + " ' WHERE password = ' " + Trim(Password) + " ' AND adminName = ' " + Trim(UserName) + " ' "
试试看吧, where那里缺少一个空格。你可以解析后放到数据库里面试试看的
[解决办法]
where 前少了空格
你用debug.print SqlStmt 就很容易看出来了!
[解决办法]
这么简单的语句怎么能有错呢?错误信息是什么啊?楼主用的是什么数据库?你不妨将password字段名修改一下,也许“password”是保留字,不能使用。
[解决办法]
SqlStmt = "UPDATE Users SET password= ' " + Trim(newPw) + " ' WHERE [password] = ' " + Trim(Password) + " ' AND adminName = ' " + Trim(UserName) + " ' "
[解决办法]
SqlStmt = "UPDATE [Users] SET [password]= ' " & Trim(newPw) & " ' WHERE [password] = ' " & Trim(Password) & " ' AND adminName = ' " & Trim(UserName) & " ' "