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'错误,我做这用户登录都快疯了,再做不好了,dawn4640576,你上回给我的代码我也看不懂,所以只好在你给我的那段代码上修改了,可是还总是不行,帮我我看看吧!