谢谢!
fwbook,请问下一个问题
进销存系统 中去判断用户名和密码是否存在以及正确,其中一个句
rs.Open "select * from [user] where name = '" & Trim(suser) & "' and password= '" & Trim(spassword) & "'", sqlconnection
If rs.RecordCount = 1 Then
checkuser = True
Else
checkuser = False
End If
If rs.RecordCount = 1 Then 不知道是什么意思?想很久也去网站查也不到是什么意思?请指点!!作者: fwbook 时间: 2010-12-13 13:01
再说了,怎么在程序里面设置用户名和密码为空?按下登录就可以?怎样修改程序?
Private Sub Command1_Click()
If checkdata = True Then
suser = Trim(Text1.Text)
spassword = Trim(Text2.Text)
If checkuser = True Then
frmmain.Show
Me.Hide
Else
MsgBox "用户名称和密码错误!请重新输入!"
Text1.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Function checkdata() As Boolean
If Len(Trim(Text1.Text)) <= 0 Or Len(Trim(Text2.Text)) <= 0 Then
MsgBox "用户名称和密码不能为空!"
Text1.SetFocus
checkdata = False
Else
checkdata = True
End If
End Function
Private Function checkuser() As Boolean
Dim rs As adodb.Recordset
Set rs = New adodb.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
sqlconnection = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
rs.Open "select * from [user] where name = '" & Trim(suser) & "' and password= '" & Trim(spassword) & "'", sqlconnection
'rs.Open "select * from user where name = '" & Trim(suser) & "' and password= '" & Trim(spassword) & "'", sqlconnection
If rs.RecordCount = 1 Then
checkuser = True
Else
checkuser = False
End If
End Function作者: fwbook 时间: 2010-12-15 08:57