请看下面一段vb程序,为什么老报错呀
来源:百度知道 编辑:UC知道 时间:2024/06/04 04:19:44
If txtUserName.Text = "" Then
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, "警告"
Else
If txtUserName.Text <> rsmc.Fields(0) Then
MsgBox "用户名错误", vbOKOnly + vbExclamation, "警告"
Else
If txtPassWord = "" Then
MsgBox "密码不能为空", vbOKOnly + vbExclamation, "警告"
Else
If txtPassWord <> rsmc.Fields(1) Then
MsgBox "密码错误", vbOKOnly + vbExclamation, "警告"
End If
End If
End If
End If
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, "警告"
Else
If txtUserName.Text <> rsmc.Fields(0) Then
MsgBox "用户名错误", vbOKOnly + vbExclamation, "警告"
Else
If txtPassWord = "" Then
MsgBox "密码不能为空", vbOKOnly + vbExclamation, "警告"
Else
If txtPassWord <> rsmc.Fields(1) Then
MsgBox "密码错误", vbOKOnly + vbExclamation, "警告"
End If
End If
End If
End If
没事我复制代码试运行了一下,发现username和password改成具体的字符串可以运行,应该是你rsmc.Fields(1)出了错,或者类型不对吧
if
else if
else if
else if
end if
按F8运行程序 单步执行,看哪里出问题了
报的是什么错?对应的地方改啊.
字符串的比较不是 用 “<>”好吧。好长时间没用过vb了。