Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > type mismatch and session variables

Reply
Thread Tools

type mismatch and session variables

 
 
s_m_b
Guest
Posts: n/a
 
      07-12-2005
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
 
Reply With Quote
 
 
 
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      07-12-2005
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.2 48.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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL Type Mismatch error indexed name returns a value whose type does not match programmingzeal VHDL 0 05-06-2012 06:38 AM
Py++, boost and python type mismatch error Murrgon Python 1 06-10-2010 03:50 PM
Type Mismatch Session muthu85 ASP .Net 0 03-16-2010 07:13 AM
asp: type mismatch and update loop Sue Adams ASP General 0 09-18-2003 08:56 PM
Type mismatch - using arrays and functions Laura ASP General 4 07-24-2003 12:30 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57