Public Function IsExistUser(strusername As String, strpwd As String) As Boolean
Dim cmd As Command
Dim rs As Recordset
Set cmd = New Command
If DataE.conLibrary.State = adStateClosed Then
DataE.conLibrary.Open
End If
cmd.ActiveConnection = DataE.conLibrary
cmd.CommandText = "select * from usertable where username='" & strusername & " '"
If strpwd <> "" Then
cmd.CommandText = cmd.CommandText + "and pwd=" & strpwd & " '"
End If
'MsgBox cmd.CommandText
Set rs = cmd.Execute '这一行提示我“类型不匹配”,请问怎么解决?!
If rs.RecordCount <> 0 Then
IsExistUser = True
If blogin Then
curuserid = rs!userid
If rs!usertype = manager Then
badmin = True
End If
If curuserid = student Then
bstudent = True
End If
End If
Else
IsExistUser = False
End If
End Function
Dim cmd As Command
Dim rs As Recordset
Set cmd = New Command
If DataE.conLibrary.State = adStateClosed Then
DataE.conLibrary.Open
End If
cmd.ActiveConnection = DataE.conLibrary
cmd.CommandText = "select * from usertable where username='" & strusername & " '"
If strpwd <> "" Then
cmd.CommandText = cmd.CommandText + "and pwd=" & strpwd & " '"
End If
'MsgBox cmd.CommandText
Set rs = cmd.Execute '这一行提示我“类型不匹配”,请问怎么解决?!
If rs.RecordCount <> 0 Then
IsExistUser = True
If blogin Then
curuserid = rs!userid
If rs!usertype = manager Then
badmin = True
End If
If curuserid = student Then
bstudent = True
End If
End If
Else
IsExistUser = False
End If
End Function
解决方案 »
- 如果用API获得网络上的某个文件的大小
- WEB调用ACTIVEX出错!
- 有几个关于mciSendString函数的问题请教各位DX
- vs5.0 SP5 install
- 请教:怎样在一个应用程序中提取经运算的 多行文本行
- 类型定义的问题,给帮忙看看。
- 苦恼! VB中我建的是Activx Control工程,在里面如何调用menu Editer中的菜单使显示出来
- ☆☆☆☆☆☆☆☆☆☆Line Input 的问题☆☆☆☆☆☆☆☆☆
- web返回叶面分析
- 用这个选择 picture1内裁剪后的图形,该用哪个API移动到picture2内呢?
- 发布一个图表控件,散分。
- DoEvent??????真的不明白是什么意思?
If Not lvar.IsExistUser(txtusername.Text, txtpassword.Text) Then '在这里调用!!
DataE.cmdadd 'txtpassword, txtrealname, txtunit, Now, udage, usertype, State
MsgBox "注册成功!", vbOKOnly + vbInformation, "注意"
Unload Me
frmsearch.Show
Else
MsgBox "用户已经存在!请重新注册一个新的用户名", vbOKOnly + vbInformation, "注意"
txtusername.Text = ""
txtpassword.Text = ""
txtpwdagain.Text = ""
txtusername.SetFocus
End If
'--------------------------------------------------------
Public Function IsExistUser(strusername As String, strpwd As String) As Boolean
Dim cmd As Command
Dim rs As Recordset
Set cmd = New Command
If DataE.conLibrary.State = adStateClosed Then
DataE.conLibrary.Open
End If
cmd.ActiveConnection = DataE.conLibrary
cmd.CommandText = "select * from usertable where username='" & strusername & " '"
If strpwd <> "" Then
cmd.CommandText = cmd.CommandText + "and pwd='" & strpwd & " '"
End If
'MsgBox cmd.CommandText
Set rs = cmd.Execute '现在提示我:[Microsoft][ODBC Microsoft Acess Driver]参数不足,期待是1
If rs.RecordCount <> 0 Then
IsExistUser = True
If blogin Then
curuserid = rs!userid
If rs!usertype = manager Then
badmin = True
End If
If curuserid = student Then
bstudent = True
End If
End If
Else
IsExistUser = False
End If
End Function
'--------------------------------
'怎么回事啊,command的 execute方法的参数是可选的啊,可以不谢参数以使用默认的值啊!!!!!!!!!拜托各位了