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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • karen

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

    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
  • CJ Taylor

    #2
    Re: error occured when i try to call server.createob ject in ASP

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


    "karen" <anonymous@disc ussions.microso ft.com> wrote in message
    news:019501c3bb 68$bdfb45e0$a40 1280a@phx.gbl.. .[color=blue]
    > 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[/color]


    Comment

    • Cor

      #3
      Re: error occured when i try to call server.createob ject in ASP

      HI CJ,

      Why you think this is VB6?

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


      Cor

      [color=blue]
      > Wrong group... look into the VB6 group, this is .NET =)[/color]



      Comment

      • Cor

        #4
        Re: error occured when i try to call server.createob ject in ASP

        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.
        [color=blue]
        > but I am aware the fact that VB doesn't support
        > inheritance so what i did is,[/color]

        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





        Comment

        • Armin Zingler

          #5
          Re: error occured when i try to call server.createob ject in ASP

          "Cor" <non@non.com> schrieb[color=blue]
          >
          > Why you think this is VB6?[/color]


          Private Sub Class_Initializ e()


          --
          Armin




          Comment

          • Cor

            #6
            OT:

            Hi Armin,[color=blue]
            >
            > Private Sub Class_Initializ e()
            >[/color]

            Can you not use that in VB.net?

            And this one in the text

            Public Sub set_ICO_SECURE_ PTR(ByVal accessor As
            icoSecureDB_tes t)

            Is that typical VB6?

            Cor


            Comment

            • Armin Zingler

              #7
              Re:

              "Cor" <non@non.com> schrieb[color=blue]
              > Hi Armin,[color=green]
              > >
              > > Private Sub Class_Initializ e()
              > >[/color]
              >
              > Can you not use that in VB.net?[/color]

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


              --
              Armin

              Comment

              • Cor

                #8
                OT:

                Hi Armin,
                [color=blue][color=green][color=darkred]
                > > >
                > > > Private Sub Class_Initializ e()
                > > >[/color]
                > >
                > > Can you not use that in VB.net?[/color]
                >
                > Is it used more often in VB.NET or in VB6? I think the answer is VB6 in
                > 99.9%
                >[/color]

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

                :-))

                Cor


                Comment

                • karen

                  #9
                  error occured when i try to call server.createob ject in ASP

                  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

                  Comment

                  • Cor

                    #10
                    Re: error occured when i try to call server.createob ject in ASP

                    Hi Karen,

                    I am happy you wrote this, I lost this one :-(

                    But still :-))

                    Cor
                    [color=blue]
                    > 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.[/color]


                    Comment

                    • Cor

                      #11
                      Re: error occured when i try to call server.createob ject in ASP

                      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


                      Comment

                      • Boogum.com

                        #12
                        Re: error occured when i try to call server.createob ject in ASP

                        On Sat, 6 Dec 2003 05:59:07 -0800, "karen"
                        <anonymous@disc ussions.microso ft.com> wrote:
                        [color=blue]
                        >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.[/color]

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

                        --Jekke
                        ==
                        To e-mail me, deobfuscate jekkeATinsidejo keDOTtv.

                        Comment

                        • Armin Zingler

                          #13
                          Re: OT:

                          "Cor" <non@non.com> schrieb[color=blue]
                          > Hi Armin,
                          >[color=green][color=darkred]
                          > > > >
                          > > > > Private Sub Class_Initializ e()
                          > > > >
                          > > >
                          > > > Can you not use that in VB.net?[/color]
                          > >
                          > > Is it used more often in VB.NET or in VB6? I think the answer is
                          > > VB6 in 99.9%
                          > >[/color]
                          >
                          > Is this to give me a lesson about quoting, you know this is not true
                          > what you are writting now I think.
                          >
                          > :-))[/color]

                          ??
                          I really think that 99.9% of VB.NET apps don't use a "sub
                          Class_Initializ e" - or didn't I get the point?


                          --
                          Armin

                          Comment

                          Working...