object variable or with block variable not set,怎么解决

lycey 2005-03-20 03:12:23
VB调试dll

一开始就错了

Set Context = GetObjectContext()
Set Response = Context("Response")

第二句就报错了

object variable or with block variable not set

网上看到有人说是空的关系,不太懂,该如何解决呢,各位帮帮忙
...全文
1582 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
lycey 2005-03-21
  • 打赏
  • 举报
回复
一天了,没人帮我看看吗?
lycey 2005-03-21
  • 打赏
  • 举报
回复
晕,不会吧,机器问题?应该不会的吧,看到网上也有这样的问题提出来,我就是没看到解决
GageCSDN 2005-03-21
  • 打赏
  • 举报
回复
.........没辙了..............

建议你换台机器调试~
lycey 2005-03-21
  • 打赏
  • 举报
回复
对啊,我早就勾过了,忘记说了,现在的情况是编译通过的,可以用

但是,如果用VB调试网页就是通不过,也就是说还是有问题
GageCSDN 2005-03-21
  • 打赏
  • 举报
回复
添加工程引用:COM+ Services Type Library

工程-->引用-->勾选"COM+ Services Type Library"-->确定就OK啦
lycey 2005-03-21
  • 打赏
  • 举报
回复
这样在里面就不能用asp的东西了,对吧
阿泰 2005-03-21
  • 打赏
  • 举报
回复
Option Explicit

Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset

Private Sub Class_Initialize()
Call OpenDB
End Sub

Private Sub Class_Terminate()
Call CloseDB
End Sub
lycey 2005-03-21
  • 打赏
  • 举报
回复
好像不可以的
hbhbhbhbhb1021 2005-03-21
  • 打赏
  • 举报
回复
在AS后面加NEW可以吗?
lycey 2005-03-21
  • 打赏
  • 举报
回复
稻草人,你看,就这些,我去掉set试过了,报错

Option Explicit

Dim Response As Response
Dim Request As Request
Dim Server As Server
Dim Application As Application
Dim Session As Session
Dim Context As ObjectContext
Dim Conn As ADODB.Connection
Dim Rs As ADODB.Recordset

Private Sub Class_Initialize()
Set Context = GetObjectContext
Set Response = Context("Response")
Set Request = Context("Request")
Set Server = Context("Server")
Set Application = Context("Application")
Set Session = Context("Session")
Call OpenDB
End Sub

Private Sub Class_Terminate()
Set Context = Nothing
Set Response = Nothing
Set Request = Nothing
Set Server = Nothing
Set Application = Nothing
Set Session = Nothing
Call CloseDB
End Sub
lycey 2005-03-21
  • 打赏
  • 举报
回复
代码就是这些,就没通过

Dim Response As Response
Dim Request As Request
Dim Server As Server
Dim Application As Application
Dim Session As Session
Dim Context As ObjectContext

Set Context = GetObjectContext
Set Response = Context("Response")
Set Request = Context("Request")
Set Server = Context("Server")
Set Application = Context("Application")
Set Session = Context("Session")
GageCSDN 2005-03-21
  • 打赏
  • 举报
回复
或者Context("Response")返回的不是一个对象,试试把:
Set Response = Context("Response")
里的Set去掉
GageCSDN 2005-03-21
  • 打赏
  • 举报
回复
函数GetObjectContext()并没有返回一个对象

给出详细代码吧
hbhbhbhbhb1021 2005-03-21
  • 打赏
  • 举报
回复
你这种情况有好多种可能性
例如你的PROJECT没引用ADODB
你的对象没实例化
试试在初始化的时候NEW一下
DIM objabc as new abc
lycey 2005-03-21
  • 打赏
  • 举报
回复
我连回三贴了,Help Me!
lycey 2005-03-20
  • 打赏
  • 举报
回复
请大家教教我吧,没人?

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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