求助 VB 用户登录的代码
Dim cn As New ADODB.ConnectionDim rs As New ADODB.Recordset
Option Explicit
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
LoginSucceeded = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
If rs.RecordCount < 0 Then
Me.Hide
Form1.Show
Else
MsgBox "无效的密码,请重试!", , "登录"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Private Sub Form_Load()
cn.Open "Driver={SQL Server};Server=yt-microsoft;Database=xw;Uid=sa;Pwd="
Set rs = cn.Execute("select * from auserlist where id = ' & txtUserName & ' and pwd = ' & txtPassword'")
End Sub
用户登录的代码应该怎么写呀!我这么写为什么填的用户名和用户的密码不一致也能登录呀!哪儿不对了!请大家指点一下,谢谢了!