VB+SQL怎么编写一个登陆界面啊?
有两个TEXTBOX。。。用户名和密码!!!急求高手解答。。。谢谢 展开
Option Explicit
Dim errpass%, password$
Dim finduser As Boolean
Public Function Searchdata(用户名 As String, 密码 As String) As Boolean
Searchdata = False
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "用户名 ='" & 用户名 & "'"
If Not Adodc1.Recordset.EOF Then
If Trim(Adodc1.Recordset.Fields("密码")) = 密码 Then Searchdata = True
End If
End Function
Private Sub Comm11_Click()
finduser = Searchdata(Trim(Text1.Text), Trim(Text2.Text))
If finduser Then
MsgBox "登录成功!", vbOKOnly, "密码登录"
Form1.Show
Me.Show
Else
errpass = errpass + 1
If errpass >= 3 Then
MsgBox "对不起,您没有任何权限登录使用本系统", vbCritical, "密码登录"
Comm11.Enabled = False
Else
MsgBox "用户名或密码错误,请重新输入", vbCritical, "密码登录"
Text1.SetFocus
End If
End If
End Sub
Private Sub Comm22_Click()
Unload Me
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & ".\yang_75.mdb"
Adodc1.RecordSource = "select * from mei"
Adodc1.Refresh
'Text2.SetFocus
Text1.Text = ""
Text2.Text = ""
Text2.PasswordChar = "*"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Adodc1.Recordset.Close
End
End Sub