vb 与access数据库编程,打包运行,在好几台计算机上测试都没有问题,唯独一台计算机上出现运行时错误’-2147217900(80040e14)’未知,发现问题出现如下代码上,请高人帮我解决一下,谢谢!
Dim sql As String
Dim connectionstring As String
connectionstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\zygl.mdb"
conn.Open connectionstring
If Trim(txtUserName.Text) = "" Then
MsgBox "请输入用户名", vbOKOnly + vbExclamation
txtUserName.Text = ""
txtUserName.SetFocus
ElseIf txtPassword.Text = "" Then
MsgBox "请输入密码", vbOKOnly + vbExclamation
txtPassword.Text = ""
txtPassword.SetFocus
Else
sql = "select * from [yh] where [用户名]='" & txtUserName.Text & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then
MsgBox "对不起,没有这个用户", vbOKOnly + vbExclamation
txtUserName.Text = ""
txtUserName.SetFocus
rs_login.Close
Set rs_login = Nothing: Set conn = Nothing
Else
If rs_login.Fields(1) = txtPassword.Text Then
rs_login.Close
Set rs_login = Nothing: Set conn = Nothing
Unload frmLogin
MDIForm1.Show
Exit Sub
Else
MsgBox "密码错误,请您重输", vbOKOnly + vbExclamation
txtPassword.Text = ""
txtPassword.SetFocus
rs_login.Close
Set rs_login = Nothing: Set conn = Nothing
End If
End If
End If
Dim sql As String
Dim connectionstring As String
connectionstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\zygl.mdb"
conn.Open connectionstring
If Trim(txtUserName.Text) = "" Then
MsgBox "请输入用户名", vbOKOnly + vbExclamation
txtUserName.Text = ""
txtUserName.SetFocus
ElseIf txtPassword.Text = "" Then
MsgBox "请输入密码", vbOKOnly + vbExclamation
txtPassword.Text = ""
txtPassword.SetFocus
Else
sql = "select * from [yh] where [用户名]='" & txtUserName.Text & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then
MsgBox "对不起,没有这个用户", vbOKOnly + vbExclamation
txtUserName.Text = ""
txtUserName.SetFocus
rs_login.Close
Set rs_login = Nothing: Set conn = Nothing
Else
If rs_login.Fields(1) = txtPassword.Text Then
rs_login.Close
Set rs_login = Nothing: Set conn = Nothing
Unload frmLogin
MDIForm1.Show
Exit Sub
Else
MsgBox "密码错误,请您重输", vbOKOnly + vbExclamation
txtPassword.Text = ""
txtPassword.SetFocus
rs_login.Close
Set rs_login = Nothing: Set conn = Nothing
End If
End If
End If
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货