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
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