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
4 个解决方案
#1
是不是有或者无access的问题?
#2
没有明白你的意思
#3
不是没有安装access的问题
#4
觉得你还是将源程序装到那机器上直接调试下吧
#1
是不是有或者无access的问题?
#2
没有明白你的意思
#3
不是没有安装access的问题
#4
觉得你还是将源程序装到那机器上直接调试下吧