Private Sub cmdOK_Click()
'检查文本框text与数据库sql的vname是否正确 '检查密码框password与数据库sql的vpassword是否正确
End Sub我是新人,有哪位大哥能提示语句该如何写?
我已经用ADODC连接好了数据库了,如何执行以上操作?
'检查文本框text与数据库sql的vname是否正确 '检查密码框password与数据库sql的vpassword是否正确
End Sub我是新人,有哪位大哥能提示语句该如何写?
我已经用ADODC连接好了数据库了,如何执行以上操作?
Dim strSQL As String
Dim rs As ADODB.Recordset
On Error GoTo proc_Err
'检查密码
strSQL = "select * from 用户表 where 用户名='" & _
trim(txtUserName) & "' and 口令='" & trim(txtPwd) & "'"
Set rs = conn.Execute(strSQL)
If rs.BOF = True Then
MsgBox "密码无效,请重新输入!", , "Login"
m_intDLCS = m_intDLCS + 1
If m_intDLCS > 3 Then
Unload Me
End If
txtPassword.SetFocus
SendKeys "{Home}+{End}"
Else
'初始化菜单
............
LoginSucceeded = True
Unload Me End Ifproc_Exit:
Set rs = Nothing
Exit Sub
proc_Err:
MsgBox err.Description, vbInformation, App.Title
err.Clear
GoTo proc_Exit
End Sub
VB里的txtUserName和txtPassword,sql里的数据库是jxj,表是login,属性是vEmployeeID和vpassword