ado中update用法疑问
sql = "select UserName from UserInfo where UserId='001'" '为了优化所以只写UserName一列Set rs = Nothing
rs.Open sql, MainDBCon, adOpenKeyset, adLockPessimistic '打开指定结果集
If rs.RecordCount > 0 Then
rs.Fields("UserName") = "刘德华" '更新指定结果集
rs.update
End If
这样的结果却把表中所有用户UserName的值变成“刘德华”了,如果要把sql改成:sql = "select * from UserInfo where UserId='001'"这样就正常了,困扰了好久想不通,请教 一下,谢谢! --------------------编程问答-------------------- MainDBCon.execute " update UserInfo set UserName='刘德华' where UserId='001'"
补充:VB , 数据库(包含打印,安装,报表)