rs_changpass.Open("select s_username,s_pass from s_user where s_username='" & UCase(Trim(TextBox2.Text)) & "'", cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
if rs_changpass.RecordCount = 0 Then
rs_changpass.addnew
rs_changpass.Fields("s_pass").Value = TextBox3.Text
rs_changpass.Update()
else
rs_changpass.Fields("s_pass").Value = TextBox3.Text
rs_changpass.Update()
End If
怎么rs_changpass.RecordCount的值为-1呢? 更新数据没问题
再看看下面的.
rs_changpass.Open("select s_username,s_pass from s_user where s_username='" & UCase(Trim(TextBox2.Text)) & "'", cn, ADODB.LockTypeEnum.adLockOptimistic)
if rs_changpass.RecordCount = 0 Then
rs_changpass.addnew
rs_changpass.Fields("s_pass").Value = TextBox3.Text
rs_changpass.Update()
else
rs_changpass.Fields("s_pass").Value = TextBox3.Text
rs_changpass.Update()
End If
这样rs_changpass.RecordCount查出的值就对,但是更新数据rs_changpass.Fields("s_pass").Value = TextBox3.Text
的时侯报错
请问怎样可以得到rs_changpass.RecordCount的值是正确的,又可以更新数据,谢谢!
[此贴子已经被作者于2007-6-22 11:17:50编辑过]