Private Sub cmdOK_Click()
Dim rs As New ADODB.Recordset
Dim cmd As New
If txtUserName.Text = "" Then
MsgBox "用户名不能为空!"
txtUserName.SetFocus
Exit Sub
Else
Call ConToSQLDB
cmd.ActiveConnection = sqlcon
= "select * from auserlist where id='" & txtUserName.Text & "'"
Set rs = cmd.Execute
If rs.EOF Then
MsgBox "用户不存在!"
rs.Close
sqlcon.Close
txtUserName.SetFocus
Exit Sub
ElseIf rs!pwd <> txtPassword.Text Then
MsgBox "密码不正确!"
rs.Close
sqlcon.Close
txtPassword.SetFocus
Exit Sub
Else
caozuoyuan = txtUserName.Text
rs.Close
Set rs = Nothing
sqlcon.Close
Unload Me
Form1.Show
End If
End If
End Sub
Function ConToSQLDB()
'*******************************
'打开与 SQL Server 数据库的连接
'*******************************
sqlcon.Provider = "sqloledb"
sqlcon.Properties("Data Source").Value = "yt-microsoft"
'//
ADMIN为SQL Server 服务器名
sqlcon.Properties("Initial Catalog").Value = "xw"
'//tempdata 为已创建数据库名
sqlcon.Properties("Integrated Security").Value = "SSPI"
sqlcon.Properties("persist security info").Value = "False"
sqlcon.Properties("user id").Value = "sa"
sqlcon.Properties("password").Value = ""
sqlcon.Open
End Function
谁能帮我看看呀,总是提示实时'424'错误,我做这用户登录都快疯了,再做不好了,哪位指点指点啊!感激!