小女子跪求代码~!!求一个vb+
Private Sub Command1_Click()
Dim conn As New ADODB。Connection
Dim sql As String
Dim rs_log As New ADODB。 Recordset
conn。Open "Provider=Microsoft。Jet。OLEDB。4。0;Data Source=C:\Documents and Settings\Administrator\My Documents\123。 mdb;Persist Security Info=False"
If Trim(Text1。Text) = "" Then ' 判断...全部
Private Sub Command1_Click()
Dim conn As New ADODB。Connection
Dim sql As String
Dim rs_log As New ADODB。
Recordset
conn。Open "Provider=Microsoft。Jet。OLEDB。4。0;Data Source=C:\Documents and Settings\Administrator\My Documents\123。
mdb;Persist Security Info=False"
If Trim(Text1。Text) = "" Then ' 判断输入的用户名是否为空
MsgBox "用户名不能为空!", vbOKOnly + vbExclamation, ""
Text1。
SetFocus
Else
sql = "select * from 用户信息 where ID='" & Text1。Text & "'"
rs_log。Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_log。
EOF = True Then
MsgBox "用户或密码错误!!!", vbOKOnly + vbExclamation, ""
Text1。SetFocus
Else ' 检验密码是否正确 用户名和密码通过后,要关闭本窗体并打开主窗体。
If Trim(rs_log。Fields(1)) = Trim(Text2。Text) Then
userID = Text1。Text
userpow = rs_log。Fields(1)
rs_log。
Close
Unload Me
main。Show
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
Text2。
SetFocus
End If
End If
End If
' 只能输入3次
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
Exit Sub
End Sub
。收起