实时错误424 要求对象 这是什么错误啊?!

jerry7981 2004-11-05 03:15:02
我照书上写了一段登陆某系统的窗口
其中有一个函数
function verify(userid as string, txtpwd as string) as boolean
dim idinfo as recordset
dim sqlstr as string
sqlstr="select worknumber,password from worker where worknumber='" & worknumber & "'"
set idinfo=coursedb.openrecordset(sqlstr,dbopensnapshot,dbreadonly) ----->这一行出错
if (idinfo.recordcount=0) then
msgbox "无此工号!",,"登陆"
verify=false
else
if (idinfo.fields("password").value=txtpwd) then
verify=true
else
msgbox "密码错!",,"登陆"
verify=false
end if
end if
idinfo.close
end function



vb提示说 实时错误424 要求对象

这是怎么回事啊?
我哪里错了?我是完全按照书上写的啊
...全文
1211 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoyuanzhi 2004-11-05
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/3431/3431300.xml?temp=.7188684
yjb136 2004-11-05
  • 打赏
  • 举报
回复
你少加了哪个控件吧,
jerry7981 2004-11-05
  • 打赏
  • 举报
回复
我定义了coursedb之后就出现错误:未识别的方法或函数

有没有其他的语句可以用啊?
我要的功能只是用户登陆时 检查用户的用户名和密码就好了
应该怎么写啊?
recollectpainer 2004-11-05
  • 打赏
  • 举报
回复
对于对象操作前需先将其实例化,既 new
ryuginka 2004-11-05
  • 打赏
  • 举报
回复
dim idinfo as recordset ,要引用ADO或者放个控件
行云边 2004-11-05
  • 打赏
  • 举报
回复
先定义coursedb
dim coursedb as new recordset
jerry7981 2004-11-05
  • 打赏
  • 举报
回复
调试的时候 我看到
set idinfo=coursedb.openrecordset(sqlstr,dbopensnapshot,dbreadonly)
中的
idinfo=nothing
dbopensnapshot=空值
dbreadonly=空值

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧