error occured when i try to call server.createobject in ASP

  • Thread starter Thread starter karen
  • Start date Start date
K

karen

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 said:
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
 
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
 
Hi Armin,
Private Sub Class_Initialize()

Can you not use that in VB.net?

And this one in the text

Public Sub set_ICO_SECURE_PTR(ByVal accessor As
icoSecureDB_test)

Is that typical VB6?

Cor
 
Hi Armin,
Is it used more often in VB.NET or in VB6? I think the answer is VB6 in
99.9%

Is this to give me a lesson about quoting, you know this is not true what
you are writting now I think.

:-))

Cor
 
Cor said:
Hi Armin,


Is this to give me a lesson about quoting, you know this is not true
what you are writting now I think.

:-))

??
I really think that 99.9% of VB.NET apps don't use a "sub
Class_Initialize" - or didn't I get the point?
 
sorry:
i think i have confused everyone..yeah.this is done in
VB6, not VB.net....
but if you could lend me some insights in this problem.
i'd truly appreciate it.

thanks,,

karen
 
Hi Karen,

To give something as a real answer.

If you are using VB6 for this, you would using probably a IIS project with
the webclass.

That had a lot of bugs and Microsoft did stopped it very quick.

When you want to reach the goals that was intended to get by that go fast to
VB.net.

I am in doubt, because your code does not look like classic asp vbs.

Just a thought and still a little bit curious.

Cor
 
sorry:
i think i have confused everyone..yeah.this is done in
VB6, not VB.net....
but if you could lend me some insights in this problem.
i'd truly appreciate it.

You would probably get more help in
microsoft.public.vb.general.discussion or one of the ASP-specific
groups. A lot of us haven't touched ASP classic in years.

--Jekke
==
To e-mail me, deobfuscate jekkeATinsidejokeDOTtv.
 
Back
Top