求高手相助我把,VB连接Access有问题,自己搞不定啊,挥泪
yonghuming password
1 1
2 2
程序代码:Option Explicit
Dim SqlStr As String
Private Sub Command1_Click()
Dim Yonghuming As String
If Text1.Text <> "" And Text2.Text <> "" Then '检查是否输入了数据
Yonghuming = Text1.Text
Adodc1.RecordSource = "Admin" '设置使用的表
SqlStr = "SELECT password FROM Admin WHERE yonghu='" & Yonghuming & "'" '输入SQL语句,查询密码
Adodc1.RecordSource = SqlStr
If Adodc1.Recordset.Fields("password") <> Text2 Then '检查密码是否正确
MsgBox "你的用户名或密码有错误!", , "发生错误了!"
Text2.Text = ""
Exit Sub
End If
Me.Hide '若密码正确则进入管理界面
guanli.Show
Else
MsgBox "请输入用户名与密码!", , "发生错误了!"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Activate()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
Adodc1.RecordSource = App.Path & "\Database11.mdb"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text2.SetFocus
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click
End Sub







怎么没有人理我呢
谢谢解答,楼主万分感谢