Arrays or Rs in Sessions : Help me plz

Discussion in 'ASP General' started by John, Jul 14, 2004.

  1. John

    John Guest

    Hi all,

    I've got an issue with session variables in asp pages. I need to make a
    decision that I think you can hopefully help me out here.

    When a session starts on the iss server I need to store some information in
    some session variables. But this information is coming from an old dbase
    system. In the beginning of this project it was just a simple static array
    of information. Afterwards it turns out that this must be a dynamic array
    that we could change in other asp pages.

    Now, at this moment, it is even worse! There are several dynamic arrays
    (max10) with a lot of records (max100) and intensive changing of data in
    those arrays, sorting it and so on.

    The big problem is that I cannot write the changes in those dbases in a
    direct way and request them back. I know, it would help me a lot. Don't ask
    why! Ask this question to the green project manager!

    When the user is logging out then all changes will be save as an xml-file on
    the server, and some queuing service is picking this up a minute later to
    control all the data and do finally some dbase changes.

    My question is: can I change the arrays into disconnected record sets and
    store them into session variables? I'm using NT2K server with II6. In the
    old days (nt4 IIS4) they always said that storing objects into session
    variables are a bad way of programming for IIS. But in this case and with
    II6???

    Some comments would be nice!

    Thanks in adv.
    Best regards,
    John
    John, Jul 14, 2004
    #1
    1. Advertising

  2. John

    Ray at Guest

    "John" <> wrote in message
    news:40f55138$0$3961$...

    >
    > My question is: can I change the arrays into disconnected record sets and
    > store them into session variables?


    Yes. The quick way is to use the .GetRows() method of the recordsetup
    object to convert a recordset into a two dimenionsal array. Either that, or
    just store the data that you need in arrays you build yourself. You don't
    want to store objects in session variables.
    (http://www.aspfaq.com/show.asp?id=2053)



    > I'm using NT2K server with II6.


    NT2K? he he he...

    If you're using Windows 2000 Server, you're using IIS5. IIS6 is on Windows
    Server 2003 only.



    > In the
    > old days (nt4 IIS4) they always said that storing objects into session
    > variables are a bad way of programming for IIS. But in this case and with
    > II6???


    Still true!

    If I were you, I'd go kick the project manager's rear.

    Ray at work
    Ray at, Jul 14, 2004
    #2
    1. Advertising

  3. John

    John Guest

    Hoi Ray@work :)

    Actually I'm receiving the data in an xml format and must convert it into a
    recordset, then save it in an array using GetRows + redim the array to add
    some more fields to it for internal usage.

    Finally store the array into a session object.

    The following page will fetch the array in the session object and convert it
    back to a connectionless recordset, doing some stuff with it (sort, add,
    change data, delete data,.) and the last step will be convert it back to an
    array and store it back into the session object. This will be done for
    several arrays on several pages :(

    >>John: I'm using NT2K server with II6.
    >>
    >>Ray : NT2K? he he he...


    :) indeed, its win2K with IIS5


    >>John: In the old days (nt4 IIS4) they always said that
    >>John: storing objects into session variables are a bad
    >>John: way of programming for IIS.
    >>
    >>Ray : Still true!


    I do remember Mr. Charles Carroll say something long ago about this issue,
    but was wondering that ms-people solved this issue in some way or another.

    >>Ray : If I were you, I'd go kick the project manager's rear.


    Why do you think he's green! His balls are disabling him to breathe ;)

    Do I really have to do all this work :( damn!

    Thanks Ray!
    John.
    John, Jul 15, 2004
    #3
  4. John wrote:
    > Hoi Ray@work :)
    >
    > Actually I'm receiving the data in an xml format and must convert it
    > into a recordset, then save it in an array using GetRows + redim the
    > array to add some more fields to it for internal usage.



    > Finally store the array into a session object.
    >
    > The following page will fetch the array in the session object and
    > convert it back to a connectionless recordset, doing some stuff with
    > it (sort, add, change data, delete data,.)


    Why not work with the array? What is the purpose of creating a recordset
    object here? I assume you are talking about creating an ad hoc array, adding
    fields to the Fields collection via the Append method and putting the data
    from the stored array into it. Why go through this trouble when you can more
    efficiently work with the array? It's not like you are going to be able to
    connect the ad hoc recordset to the data source and persist the changes
    you've made.

    Instead of the array, you might want to consider using an xml document,
    which will be a little easier to work with than the array.

    > and the last step will be
    > convert it back to an array and store it back into the session
    > object. This will be done for several arrays on several pages :(
    >


    >>> John: I'm using NT2K server with II6.
    >>>
    >>> Ray : NT2K? he he he...

    >
    > :) indeed, its win2K with IIS5
    >
    >
    >>> John: In the old days (nt4 IIS4) they always said that
    >>> John: storing objects into session variables are a bad
    >>> John: way of programming for IIS.
    >>>
    >>> Ray : Still true!

    >
    > I do remember Mr. Charles Carroll say something long ago about this
    > issue, but was wondering that ms-people solved this issue in some way
    > or another.


    No. Especially if Access is involved. There is a way to make ADO objects
    free-threaded (and therefore capable of being stored in Session), but this
    should be avoided if Access is being used on the server, because Jet is
    single-threaded.

    If Access is not involved, you can make a registry change to cause ADO
    objects to be free-threaded, using a batch file that is installed by MDAC in
    the ...\project files\common files\system\ado folder called makfre12.bat.

    >

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jul 15, 2004
    #4
    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. brian

    Size of my Struct? PLZ PLZ reply

    brian, Nov 23, 2004, in forum: C Programming
    Replies:
    7
    Views:
    417
    -berlin.de
    Nov 25, 2004
  2. Replies:
    1
    Views:
    379
  3. Replies:
    2
    Views:
    335
    Nick Keighley
    Nov 24, 2006
  4. Replies:
    1
    Views:
    339
  5. nocturnal
    Replies:
    1
    Views:
    523
    nocturnal
    Jul 10, 2009
Loading...

Share This Page