问题描述
- 求助,我用vb6做的登录界面出现实时错误‘-21472178650(80040e37)’
-
这是源码:
Option ExplicitPrivate Sub Command1_Click()
Dim Connectionstring As String
Dim conn As New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:Users名洲Desktop工程DataTest.mdb;Persist Security Info=False"
Dim sql As String
Dim rs_login As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
MsgBox "用户名不能为空,请重新输入!", vbOKOnly + vbExclamation, "错误"
Text1.SetFocus
Else
sql = "select*from Test where test_info='" & Text1.Text & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then
MsgBox "用户名不存在,请重新输入!", vbOKOnly + vbExclamation, "错误"
Text1 = ""
Text1.SetFocus
Else
If Trim(rs_login.Fields(1)) = Trim(Text2) Then
rs_login.Close
Unload Me
Form2.Show
Else
MsgBox "密码错误,请重新输入!", vbOKOnly + vbExclamation, "错误"
Text2.SetFocus
End If
End If
End If
End SubPrivate Sub Command2_Click()
MsgBox "您已成功退出!", vbOKOnly + vbExclamation, "提示"
Unload Me
End Sub
解决方案
哦,错了,是实时错误‘-2147217865(80040e37)’
解决方案二:
设断点,调试。谁也没法靠眼睛看出来你的问题在哪里。
解决方案三:
将程序分成几个块,然后确定哪些部分是绝对就没有问题的,然后调试那些可能存在错误的地方