首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

用户登录有有关问题,麻烦帮忙看一下哪里有有关问题,多谢

2012-01-14 
用户登录有问题,麻烦帮忙看一下哪里有问题,谢谢?我的用户登录无论输入哪个用户名,程序只认第一条用户的密

用户登录有问题,麻烦帮忙看一下哪里有问题,谢谢?
我的用户登录无论输入哪个用户名,程序只认第一条用户的密码,帮忙看看我代码错在哪里,麻烦了
登陆界面代码
Public OK As Boolean

Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub


Private Sub cmdOK_Click()
  Static try_times As Byte
Dim strusername As String
Dim strpassword As String
strusername = txtUserName.Text
strpassword = txtPassword.Text
If strusername = "" Then
MsgBox "请输入用户名", vbOKOnly + vbCritical, "警告"
txtUserName.SetFocus
Exit Sub
End If
If strpassword = "" Then
MsgBox "请输入密码", vbOKOnly + vbCritical, "警告"
txtPassword.SetFocus
Exit Sub
End If
strusername = makestr(strusername)
strpassword = makestr(strpassword)
If myuser.existuser(strusername) = False Then
MsgBox "用户名不存在", vbOKOnly + vbCritical, "警告"
txtUserName = ""
txtUserName.SetFocus
try_times = try_times + 1
If try_times >= 3 Then
MsgBox "对不起,您已经尝试三次进入系统,均不成功,系统将关闭!", vbOKOnly + vbCritical, "警告"
disconnect
OK = False
Me.Hide
Exit Sub
Else
Exit Sub
End If
End If
myuser.getinfo (strusername)
If myuser.strpwd <> strpassword Then
MsgBox "密码错误", vbOKOnly + vbCritical, "警告"
txtPassword.Text = ""
txtPassword.SetFocus
try_times = try_times + 1
If try_times = try_times >= 3 Then
MsgBox "对不起,您已经尝试三次进入系统,均不成功,系统将关闭!", vbOKOnly + vbCritical, "警告"
disconnect
OK = False
Me.Hide
Exit Sub
Else
Exit Sub
End If
End If
curuser.iuserclass = myuser.iuserclass
curuser.strname = myuser.strname
curuser.strpwd = myuser.strpwd
OK = True
Me.Hide
End Sub



[解决办法]

探讨
引用:VB codestrSQL="select*from [用户登录] where name+'"+Trim(username)="'"'加这个试试msgbox strSQLSet rs= queryext(strSQL)
没用啊,不过谢谢你

热点排行