数据库连接!

placj placj 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
一个简单的登录代码,我用ACCESS做数据库时没问题,但换成SQL2000后 代码一样 每次点击登录时只能判断到用户名,密码我输入正确的他也提示错误晕死!请问为什么?是不是SQL2000我建表时数据类型不对?
代码如下:
Private Sub cmdDL_Click()
Static miCount As Integer
If txtUserName = "" Then
MsgBox "用户名不能为空,请重输入!", vbExclamation + vbOKOnly, "系统提示!"
txtUserName.SetFocus
Exit Sub
End If

txtSQL = "select * from User_Info where User_Name='" & txtUserName & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF Then
MsgBox "用户名不正确,请重新输入!", vbExclamation + vbOKOnly, "系统提示!"
txtUserName = ""
txtPassword.Enabled = False
txtUserName.SetFocus
Exit Sub
Else
txtPassword.Enabled = True
End If

If txtPassword <> "" Then
Debug.Print (mrc.Fields("User_Password"))
If mrc.Fields("User_Password") <> txtPassword Then
MsgBox "密码错误,请重新输入!", vbExclamation + vbOKOnly, "系统提示!"
txtPassword = ""
txtPassword.SetFocus
miCount = miCount + 1
If miCount >= 3 Then
MsgBox "无权操作本系统!再见!", vbOKOnly + vbExclamation, "警告"
End
End If
Else
frmMainMDI.Show
Unload frmLogin
End If
Else
End If

If txtUserName <> "" Then
txtPassword.SetFocus
Exit Sub
End If
End Sub
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部