我尝试在ASP中调用server.createobject时发生错误 [英] error occured when i try to call server.createobject in ASP

查看:68
本文介绍了我尝试在ASP中调用server.createobject时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:

这将是一个很长的帖子。所以我在

提前道歉:)

我正在转换VB中的java程序。我是一名经过交易的
java程序员。所以我不是这个

部门的专家。

我写了以下三个课:


1.icoCORE_test

2.icoMINDB_test

3.icoSecureDB_test

4. Country_test

我的java代码中的
,icoMINDB_test扩展icoCore_test,

icoSecureDB_test扩展icoMINDB_test

和Country_test扩展icoSecureDB_test


但是我知道VB不支持

继承所以我做的是,

这是最顶级的icoCore_test

[vb]

私人Sub Class_Initialize()


''尝试加载内置的ASP对象。

调用loadASPObjects


' '加载主连接字符串。

调用loadMainConnString

end sub


[/ vb]

在icoMINDB_test中,我将ptr分配给icoCore_test,下面

是来自icoMINDB_test的代码片段

[vb]

Option Expl icit


''对icoMINDB的父类的对象引用-icoCORE

私有icoCORE_Accessor为icoCORE_test

Private Sub Class_Initialize ()

''现在,laodDefaults什么都不做

调用loadDefaults


End Sub

Public Sub setICO_CORE_Ptr(ByVal accessor As icoCORE_test)

''初始化icoCORE_Accessor

设置icoCORE_Accessor =访问者

结束Sub

[/ vb]

icoSecureDB_test中的
,我将ptr分配给icoCore_test,
下面的
是来自的代码片段icoSecureDB_test

[vb]

私人icoMINDB_Accessor为icoMINDB_test


Public Sub set_ICO_MINDB_PTR(ByVal accessor As

icoMINDB_test)

''initaite icoMINDB_Accessor

设置icoMINDB_Accessor =访问者

结束子


[ / vb]

Country_test中的
,我将一个ptr分配给icoSecureD B_test,

以下是来自Country_test的代码片段

[vb]

私有子类_初始化()


''设置表名,pKey值和连接类型

SecureDB_Accessor.getICOMINDBAccessor.TableName

=" Countries"

SecureDB_Accessor .getICOMINDBAccessor.PKeyName

=" Country_Code"

SecureDB_Accessor.getICOMINDBAccessor.ConnType =

SecureDB_Accessor.getICOMINDBAccessor.TYPE_MAIN

''添加更多,如果需要


结束子

Public Sub set_ICO_SECURE_PTR(ByVal accessor As

icoSecureDB_test)

设置SecureDB_Accessor =访问者


结束子

[/ vb]


发生了什么我在我的ASP代码中做了以下内容

[vb]

''实例化icoCore_test对象

dim objCore

set objCore = Server.createObject(" icoCore_test")


' '实例化icoMINDB_test对象

dim objMINDB

set objMINDB = Server.createObject(" icoMINDB_test")


''设置linke objMINDB到其父级的ptr:icoCore

objMINDB.setICO_CORE_Ptr(objCore)


''实例化icoSecureDB_test对象

dim objsecureDB

set objsecureDB = Server.createObject(" icoSecureDB_test")

''将linke objsecureDB的ptr设置为其父级:

icoMINDB

objsecureDB.set_ICO_MINDB_PTR(objMINDB)

''实例化country_test对象

dim objCountry
set objCountry = Server.createObject(" Country_test")

''将linke objsecureDB的ptr设置为其父级:

icoSecureDB

objCountry.set_ICO_SECURE_PTR(objsecureDB)

[/ vb]


当我尝试运行这个asp页面时,我得到以下

错误:

对象变量或未设置块


但奇怪的是,如果我只是实例化:icoCore

对象,在层次中最顶级的,它很好。

我甚至可以测试一些功能。

所以我真的很困惑,问题出在哪里。

真的没有办法调试这个,因为这是一个

问题,最基本的错误就像设置对象一样。

我的问题这就是为什么我得到这个奇怪的错误信息。

以及为什么它适用于最顶级的课程而不是它的

descedant课程......

当你调用server.createObject(" className")时,一个类的'

子类Class_Initialize()被调用了吗?我猜是

它在icoCore_test中:在Class_Initialize()中

[vb]

私有子Class_Initialize()


''尝试加载内置ASP对象。

调用loadASPObjects


''加载主连接字符串。 />
调用loadMainConnString

end sub

[/ vb]

laodASPObjects()被调用,但是有些asp设置

不在global.asa文件中提供?所以我得到

这个对象变量或者没有设置块 ????

我真的很感激,如果有人可以给我一些

帮助这个


非常感谢

解决方案

错误的组...查看VB6组,这是.NET =)

" karen" <一个******* @ discussions.microsoft.com>在消息中写道

news:01 **************************** @ phx.gbl ... < blockquote class =post_quotes>大家好:
这将是一个很长的帖子。所以我在
提前道歉:)
我正在转换VB中的java程序。我是一名贸易的java程序员。所以我不是这个部门的专家。
我写了以下三个课:

1.icoCORE_test
2.icoMINDB_test
3.icoSecureDB_test
4. Country_test

在我的java代码中,icoMINDB_test扩展了icoCore_test,
icoSecureDB_test扩展了icoMINDB_test
而Country_test扩展了icoSecureDB_test

但我是意识到VB不支持
继承的事实所以我所做的是,
这是最顶级的icoCore_test
[vb]
Private Sub Class_Initialize()

''尝试加载内置ASP对象。
调用loadASPObjects

''加载主连接字符串。
调用loadMainConnString
结束在icoMINDB_test中我分配了一个ptr到icoCore_test,下面是/ icoMINDB_test的代码片段
[vb]
选项明确

'对icoMINDB的父类的对象引用-icoCORE
私有icoCORE_Accessor作为icoCOR E_test
Private Sub Class_Initialize()
''现在,laodDefaults什么都不做
调用loadDefaults

End Sub
Public Sub setICO_CORE_Ptr(ByVal accessor As icoCORE_test)
''初始化icoCORE_Accessor
在icoSecureDB_test中设置icoCORE_Accessor = accessor
End Sub
[/ vb]

,我将一个ptr分配给icoCore_test,下面是来自icoSecureDB_test的代码片段
[vb]
私有icoMINDB_Accessor作为icoMINDB_test

Public Sub set_ICO_MINDB_PTR(ByVal accessor As
icoMINDB_test)
''initaite icoMINDB_Accessor
在Country_test中设置icoMINDB_Accessor = accessor
End Sub

[/ vb]

我分配了一个ptr到icoSecureDB_test,下面是来自Country_test的代码片段
[vb]
Private Sub Class_Initialize()

''设置表名,pKey值和连接类型
SecureDB_Accessor.getICOMI NDBAccessor.TableName
=" Countries"
SecureDB_Accessor.getICOMINDBAccessor.PKeyName
=" Country_Code"
SecureDB_Accessor.getICOMINDBAccessor.ConnType =
SecureDB_Accessor.getICOMINDBAccessor.TYPE_MAIN <如果需要,添加更多内容

结束Sub
Public Sub set_ICO_SECURE_PTR(ByVal accessor As
icoSecureDB_test)
设置SecureDB_Accessor = accessor
<结束Sub
[/ vb]

我在ASP代码中执行了以下操作
[vb]
''实例化icoCore_test对象< brim> dim objCore
设置objCore = Server.createObject(" icoCore_test")
''实例化icoMINDB_test对象
dim objMINDB
设置objMINDB = Server。 createObject(" icoMINDB_test")
''设置linke objMINDB到其父级的ptr:icoCore
objMINDB.setICO_CORE_Ptr(objCore)

''实例化icoSecureDB_test对象
昏暗的objs ecureDB
设置objsecureDB = Server.createObject(" icoSecureDB_test")
''将linke objsecureDB的ptr设置为其父级:
icoMINDB
objsecureDB.set_ICO_MINDB_PTR( objMINDB)
''实例化country_test对象
dim objCountry
设置objCountry = Server.createObject(" Country_test")

''设置ptr,linke objsecureDB给它的父级:
icoSecureDB
objCountry.set_ICO_SECURE_PTR(objsecureDB)

[/ vb]

当我尝试运行这个asp时页面,我得到以下
错误:
对象变量或没有设置块

但奇怪的是,如果我只是实例化:icoCore
对象,在层次中最顶级的,它很好。
我甚至可以测试一些功能。
所以我真的很困惑,问题出在哪里。
真的没有办法调试这个,因为这是一个最基本的错误,如设置的问题一个对象。
我的问题是为什么我会收到这个奇怪的错误信息。
以及为什么它适用于最顶级的课程而不是它的课程......
你调用server.createObject(" className")一个类'的子类_Initialize()被调用了吗?我猜是因为它在icoCore_test中:在Class_Initialize()中
[vb]
Private Sub Class_Initialize()

''尝试加载内置ASP调用loadASPObjects

''加载主连接字符串。
调用loadMainConnString
结束子
[/ vb]
laodASPObjects( )被调用,但是global.asa文件中没有提供一些asp设置
?所以我得到了这个对象变量或没有设置块的对象。 ????
如果有人能给我一些帮助,我真的很感激

非常感谢



HI CJ,


为什么你认为这是VB6?


我认为这是vb.net也许可以使用Visual.studio.net

Cor

错误的组...查看VB6组,这是.NET =)



嗨karen,


这是一个很长的帖子因此不容易回答我采取了一些措辞从它获得
并尝试先告诉你一些事情。


在VB.net中使用的是窗体,webforms和独立的aspx.pages。


有时令人困惑的是你可以在及时编译中使用它和

与vb.net制作的dll'(顺便说一下再次编译)通过

框架,因为它是中间语言。)


也许告诉我们如何明智你正在使用它,而不是从问题中得到更多的理解。

但我知道VB不支持
继承所以我所做的是,




但是这件事我确实发现了你信息中的一个重要部分。这个

的新闻组充满了继承,它是所有编码的主要部分。

VB.net,所有类都是从更高级别继承的。


我希望这会有所帮助


Cor


Hi all :
this is going to be a long post. So i apologize in
advance :)
i am converting a java program in VB right now. I am a
java programmer by trade. so i am no expert in this
department.
I have written the following three class:

1.icoCORE_test
2.icoMINDB_test
3.icoSecureDB_test
4. Country_test

in my java code, icoMINDB_test extends icoCore_test,
icoSecureDB_test extends icoMINDB_test
and Country_test extends icoSecureDB_test

but I am aware the fact that VB doesn''t support
inheritance so what i did is,
this is the top most class icoCore_test
[vb]
Private Sub Class_Initialize()

''Attempt to load built-in ASP objects.
Call loadASPObjects

''Load the main connection string.
Call loadMainConnString
end sub

[/vb]
in icoMINDB_test, i assigned a ptr to icoCore_test, below
is the code fragment from icoMINDB_test
[vb]
Option Explicit

''an object reference to icoMINDB''s parent class -icoCORE
Private icoCORE_Accessor As icoCORE_test
Private Sub Class_Initialize()
''right now, the laodDefaults doesn''t do anything
Call loadDefaults

End Sub

Public Sub setICO_CORE_Ptr(ByVal accessor As icoCORE_test)
''initialize icoCORE_Accessor
Set icoCORE_Accessor = accessor
End Sub
[/vb]

in icoSecureDB_test, i assigned a ptr to icoCore_test,
below is the code fragment from icoSecureDB_test
[vb]
Private icoMINDB_Accessor As icoMINDB_test

Public Sub set_ICO_MINDB_PTR(ByVal accessor As
icoMINDB_test)
''initaite icoMINDB_Accessor
Set icoMINDB_Accessor = accessor
End Sub

[/vb]

in Country_test, i assigned a ptr to icoSecureDB_test,
below is the code fragment from Country_test
[vb]
Private Sub Class_Initialize()

''set the table name, pKey value and connection type
SecureDB_Accessor.getICOMINDBAccessor.TableName
= "Countries"
SecureDB_Accessor.getICOMINDBAccessor.PKeyName
= "Country_Code"
SecureDB_Accessor.getICOMINDBAccessor.ConnType =
SecureDB_Accessor.getICOMINDBAccessor.TYPE_MAIN
''add more, if neccessary

End Sub
Public Sub set_ICO_SECURE_PTR(ByVal accessor As
icoSecureDB_test)
Set SecureDB_Accessor = accessor

End Sub
[/vb]

what happen is i did the following in my ASP code
[vb]
''instantiate the icoCore_test object
dim objCore
set objCore = Server.createObject("icoCore_test")

''instantiate the icoMINDB_test object
dim objMINDB
set objMINDB = Server.createObject("icoMINDB_test")

''set the ptr that linke objMINDB to its parent: icoCore
objMINDB.setICO_CORE_Ptr(objCore)

''instantiate the icoSecureDB_test object
dim objsecureDB
set objsecureDB = Server.createObject("icoSecureDB_test")

''set the ptr that linke objsecureDB to its parent:
icoMINDB
objsecureDB.set_ICO_MINDB_PTR(objMINDB)

''instantiate the country_test object
dim objCountry
set objCountry = Server.createObject("Country_test")

''set the ptr that linke objsecureDB to its parent:
icoSecureDB
objCountry.set_ICO_SECURE_PTR(objsecureDB)

[/vb]

when i try to run this asp page, i got the following
error:
"object variable or with block not set"

but strangely enough, if i just instantiate: icoCore
object, the top most class in the hierachy, it is fine.
and i could even test out some of the functionality.
so I am just really puzzled as to where the problem is.
there really is no way to debug this because this is a
problem with the most basic error like setting an object.
my question is why am i getting this strange error msg.
and why it worked for the top most class but not its
descedant classes...
when you call server.createObject("className") a class''s
sub Class_Initialize() is called right? i am guessing is
it becuase in icoCore_test: in Class_Initialize()
[vb]
Private Sub Class_Initialize()

''Attempt to load built-in ASP objects.
Call loadASPObjects

''Load the main connection string.
Call loadMainConnString
end sub
[/vb]
laodASPObjects() are called, but some of the asp settings
are not provided in the global.asa file?? so i am getting
this "object variable or with block not set" ???
i''d really appreciate it if someone can offer me some
help on this

Many thanks

解决方案

Wrong group... look into the VB6 group, this is .NET =)
"karen" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...

Hi all :
this is going to be a long post. So i apologize in
advance :)
i am converting a java program in VB right now. I am a
java programmer by trade. so i am no expert in this
department.
I have written the following three class:

1.icoCORE_test
2.icoMINDB_test
3.icoSecureDB_test
4. Country_test

in my java code, icoMINDB_test extends icoCore_test,
icoSecureDB_test extends icoMINDB_test
and Country_test extends icoSecureDB_test

but I am aware the fact that VB doesn''t support
inheritance so what i did is,
this is the top most class icoCore_test
[vb]
Private Sub Class_Initialize()

''Attempt to load built-in ASP objects.
Call loadASPObjects

''Load the main connection string.
Call loadMainConnString
end sub

[/vb]
in icoMINDB_test, i assigned a ptr to icoCore_test, below
is the code fragment from icoMINDB_test
[vb]
Option Explicit

''an object reference to icoMINDB''s parent class -icoCORE
Private icoCORE_Accessor As icoCORE_test
Private Sub Class_Initialize()
''right now, the laodDefaults doesn''t do anything
Call loadDefaults

End Sub

Public Sub setICO_CORE_Ptr(ByVal accessor As icoCORE_test)
''initialize icoCORE_Accessor
Set icoCORE_Accessor = accessor
End Sub
[/vb]

in icoSecureDB_test, i assigned a ptr to icoCore_test,
below is the code fragment from icoSecureDB_test
[vb]
Private icoMINDB_Accessor As icoMINDB_test

Public Sub set_ICO_MINDB_PTR(ByVal accessor As
icoMINDB_test)
''initaite icoMINDB_Accessor
Set icoMINDB_Accessor = accessor
End Sub

[/vb]

in Country_test, i assigned a ptr to icoSecureDB_test,
below is the code fragment from Country_test
[vb]
Private Sub Class_Initialize()

''set the table name, pKey value and connection type
SecureDB_Accessor.getICOMINDBAccessor.TableName
= "Countries"
SecureDB_Accessor.getICOMINDBAccessor.PKeyName
= "Country_Code"
SecureDB_Accessor.getICOMINDBAccessor.ConnType =
SecureDB_Accessor.getICOMINDBAccessor.TYPE_MAIN
''add more, if neccessary

End Sub
Public Sub set_ICO_SECURE_PTR(ByVal accessor As
icoSecureDB_test)
Set SecureDB_Accessor = accessor

End Sub
[/vb]

what happen is i did the following in my ASP code
[vb]
''instantiate the icoCore_test object
dim objCore
set objCore = Server.createObject("icoCore_test")

''instantiate the icoMINDB_test object
dim objMINDB
set objMINDB = Server.createObject("icoMINDB_test")

''set the ptr that linke objMINDB to its parent: icoCore
objMINDB.setICO_CORE_Ptr(objCore)

''instantiate the icoSecureDB_test object
dim objsecureDB
set objsecureDB = Server.createObject("icoSecureDB_test")

''set the ptr that linke objsecureDB to its parent:
icoMINDB
objsecureDB.set_ICO_MINDB_PTR(objMINDB)

''instantiate the country_test object
dim objCountry
set objCountry = Server.createObject("Country_test")

''set the ptr that linke objsecureDB to its parent:
icoSecureDB
objCountry.set_ICO_SECURE_PTR(objsecureDB)

[/vb]

when i try to run this asp page, i got the following
error:
"object variable or with block not set"

but strangely enough, if i just instantiate: icoCore
object, the top most class in the hierachy, it is fine.
and i could even test out some of the functionality.
so I am just really puzzled as to where the problem is.
there really is no way to debug this because this is a
problem with the most basic error like setting an object.
my question is why am i getting this strange error msg.
and why it worked for the top most class but not its
descedant classes...
when you call server.createObject("className") a class''s
sub Class_Initialize() is called right? i am guessing is
it becuase in icoCore_test: in Class_Initialize()
[vb]
Private Sub Class_Initialize()

''Attempt to load built-in ASP objects.
Call loadASPObjects

''Load the main connection string.
Call loadMainConnString
end sub
[/vb]
laodASPObjects() are called, but some of the asp settings
are not provided in the global.asa file?? so i am getting
this "object variable or with block not set" ???
i''d really appreciate it if someone can offer me some
help on this

Many thanks



HI CJ,

Why you think this is VB6?

I think this is vb.net maybe used withouth Visual.studio.net
Cor

Wrong group... look into the VB6 group, this is .NET =)




Hi karen,

It is a long post and therefore not easy to answer I take some words from it
and try to tell you something first.

In VB.net are used windowforms, webforms and stand alone aspx.pages.

Sometimes confusing is that you can use it with just in time compiling and
with dll''s made by vb.net for that (which are by the way again compiled by
the framework because it is intermidiate language).

Maybe it is wise to tell us how you are using it, than we get some more
understanding from the problem.

but I am aware the fact that VB doesn''t support
inheritance so what i did is,



But this thing I did find primaly a important part of your message. This
newsgroup is full of inheritance and it is a major part of all coding in
VB.net, all classes inherite all the time from a higher class.

I hope this helps something

Cor


这篇关于我尝试在ASP中调用server.createobject时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆