type mismatch and session variables

Discussion in 'ASP General' started by s_m_b, Jul 12, 2005.

  1. s_m_b

    s_m_b Guest

    I am having a problem with a page that creates a treeview from a database,
    by reloading itself on each request for a new folder to be explored.
    The problem revolves around using an array to store the data, that is
    copied to a session variable, and reloaded from that with each new view.
    That is, on first opening the page, the array is created and populated,
    then copied over; subsequent reloads of the page load the session variable,
    rather than create the array. This is where the problem lies - by DIMing
    the array, the first load of the page is fine, but a type mismatch pops up
    when the session is pulled in to the array name; not DIMing the array, the
    first load fails due to not declaring the array.

    Currently the ony way I have round the problem is to switch option explicit
    off and not DIM any variable. If there was a way to have the session
    variable and array co-exist to start with, that would be good.

    TIA
     
    s_m_b, Jul 12, 2005
    #1
    1. Advertising

  2. I always bring arrays local before referencing them. This might help a
    little bit (though not directly related):
    http://www.aspfaq.com/2524




    "s_m_b" <> wrote in message
    news:Xns96919B762AE7Bsmb2000nshotrmailcom@207.46.248.16...
    >I am having a problem with a page that creates a treeview from a database,
    > by reloading itself on each request for a new folder to be explored.
    > The problem revolves around using an array to store the data, that is
    > copied to a session variable, and reloaded from that with each new view.
    > That is, on first opening the page, the array is created and populated,
    > then copied over; subsequent reloads of the page load the session
    > variable,
    > rather than create the array. This is where the problem lies - by DIMing
    > the array, the first load of the page is fine, but a type mismatch pops up
    > when the session is pulled in to the array name; not DIMing the array, the
    > first load fails due to not declaring the array.
    >
    > Currently the ony way I have round the problem is to switch option
    > explicit
    > off and not DIM any variable. If there was a way to have the session
    > variable and array co-exist to start with, that would be good.
    >
    > TIA
     
    Aaron Bertrand [SQL Server MVP], Jul 12, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. muthu85

    Type Mismatch Session

    muthu85, Mar 16, 2010, in forum: .NET
    Replies:
    0
    Views:
    672
    muthu85
    Mar 16, 2010
  2. Murrgon
    Replies:
    1
    Views:
    392
    Thomas Jollans
    Jun 10, 2010
  3. Laura
    Replies:
    4
    Views:
    160
    Joe Iano
    Jul 24, 2003
  4. Sue Adams

    asp: type mismatch and update loop

    Sue Adams, Sep 18, 2003, in forum: ASP General
    Replies:
    0
    Views:
    153
    Sue Adams
    Sep 18, 2003
  5. programmingzeal
    Replies:
    0
    Views:
    1,135
    programmingzeal
    May 6, 2012
Loading...

Share This Page