图4.5 管理员主界面
员工登录界面验证密码部分代码:
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
If conn.State = 1 Then
conn.Close
End If
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\111.mdb;" & _
"Persist Security Info=False"
conn.Open
End Sub
Private Sub Command1_Click()
SQL = "select * from 口令信息 where 员工编号='" & Text1.Text & "'" & "and 密码='" & Text2.Text & "'"
If rs.State = 1 Then
rs.Close
End If
rs.Open SQL, conn, 1, 3
If rs.EOF Then
MsgBox "用户名或密码错了!", 32, "警告"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
员工主界面.Show
员工主界面.Text1.Text = Text1.Text
conn.Close
Unload Me
End If
Exit Sub
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Text2.SetFocus
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)