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_t est
4. Country_test
in my java code, icoMINDB_test extends icoCore_test,
icoSecureDB_tes t extends icoMINDB_test
and Country_test extends icoSecureDB_tes t
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_Initializ e()
'Attempt to load built-in ASP objects.
Call loadASPObjects
'Load the main connection string.
Call loadMainConnStr ing
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_Accesso r As icoCORE_test
Private Sub Class_Initializ e()
'right now, the laodDefaults doesn't do anything
Call loadDefaults
End Sub
Public Sub setICO_CORE_Ptr (ByVal accessor As icoCORE_test)
'initialize icoCORE_Accesso r
Set icoCORE_Accesso r = accessor
End Sub
[/vb]
in icoSecureDB_tes t, i assigned a ptr to icoCore_test,
below is the code fragment from icoSecureDB_tes t
[vb]
Private icoMINDB_Access or As icoMINDB_test
Public Sub set_ICO_MINDB_P TR(ByVal accessor As
icoMINDB_test)
'initaite icoMINDB_Access or
Set icoMINDB_Access or = accessor
End Sub
[/vb]
in Country_test, i assigned a ptr to icoSecureDB_tes t,
below is the code fragment from Country_test
[vb]
Private Sub Class_Initializ e()
'set the table name, pKey value and connection type
SecureDB_Access or.getICOMINDBA ccessor.TableNa me
= "Countries"
SecureDB_Access or.getICOMINDBA ccessor.PKeyNam e
= "Country_Co de"
SecureDB_Access or.getICOMINDBA ccessor.ConnTyp e =
SecureDB_Access or.getICOMINDBA ccessor.TYPE_MA IN
'add more, if neccessary
End Sub
Public Sub set_ICO_SECURE_ PTR(ByVal accessor As
icoSecureDB_tes t)
Set SecureDB_Access or = 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.createOb ject("icoCore_t est")
'instantiate the icoMINDB_test object
dim objMINDB
set objMINDB = Server.createOb ject("icoMINDB_ test")
'set the ptr that linke objMINDB to its parent: icoCore
objMINDB.setICO _CORE_Ptr(objCo re)
'instantiate the icoSecureDB_tes t object
dim objsecureDB
set objsecureDB = Server.createOb ject("icoSecure DB_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.createOb ject("Country_t est")
'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.createOb ject("className ") a class's
sub Class_Initializ e() is called right? i am guessing is
it becuase in icoCore_test: in Class_Initializ e()
[vb]
Private Sub Class_Initializ e()
'Attempt to load built-in ASP objects.
Call loadASPObjects
'Load the main connection string.
Call loadMainConnStr ing
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_t est
4. Country_test
in my java code, icoMINDB_test extends icoCore_test,
icoSecureDB_tes t extends icoMINDB_test
and Country_test extends icoSecureDB_tes t
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_Initializ e()
'Attempt to load built-in ASP objects.
Call loadASPObjects
'Load the main connection string.
Call loadMainConnStr ing
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_Accesso r As icoCORE_test
Private Sub Class_Initializ e()
'right now, the laodDefaults doesn't do anything
Call loadDefaults
End Sub
Public Sub setICO_CORE_Ptr (ByVal accessor As icoCORE_test)
'initialize icoCORE_Accesso r
Set icoCORE_Accesso r = accessor
End Sub
[/vb]
in icoSecureDB_tes t, i assigned a ptr to icoCore_test,
below is the code fragment from icoSecureDB_tes t
[vb]
Private icoMINDB_Access or As icoMINDB_test
Public Sub set_ICO_MINDB_P TR(ByVal accessor As
icoMINDB_test)
'initaite icoMINDB_Access or
Set icoMINDB_Access or = accessor
End Sub
[/vb]
in Country_test, i assigned a ptr to icoSecureDB_tes t,
below is the code fragment from Country_test
[vb]
Private Sub Class_Initializ e()
'set the table name, pKey value and connection type
SecureDB_Access or.getICOMINDBA ccessor.TableNa me
= "Countries"
SecureDB_Access or.getICOMINDBA ccessor.PKeyNam e
= "Country_Co de"
SecureDB_Access or.getICOMINDBA ccessor.ConnTyp e =
SecureDB_Access or.getICOMINDBA ccessor.TYPE_MA IN
'add more, if neccessary
End Sub
Public Sub set_ICO_SECURE_ PTR(ByVal accessor As
icoSecureDB_tes t)
Set SecureDB_Access or = 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.createOb ject("icoCore_t est")
'instantiate the icoMINDB_test object
dim objMINDB
set objMINDB = Server.createOb ject("icoMINDB_ test")
'set the ptr that linke objMINDB to its parent: icoCore
objMINDB.setICO _CORE_Ptr(objCo re)
'instantiate the icoSecureDB_tes t object
dim objsecureDB
set objsecureDB = Server.createOb ject("icoSecure DB_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.createOb ject("Country_t est")
'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.createOb ject("className ") a class's
sub Class_Initializ e() is called right? i am guessing is
it becuase in icoCore_test: in Class_Initializ e()
[vb]
Private Sub Class_Initializ e()
'Attempt to load built-in ASP objects.
Call loadASPObjects
'Load the main connection string.
Call loadMainConnStr ing
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
Comment