By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,695 Members | 1,284 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,695 IT Pros & Developers. It's quick & easy.

class -session variable

P: n/a
Hi,
I want to do things this way:

I have a bunch of stuff that I want to keep track of while a user is
connected to the site. Maybe 50 little peices of information.

So I know I can make 50 session variables , or an store an array in a
session variable, but what I wanna do is store it all in a class
so I can use property get and property let.

I want to store this class in a session variable so I don't lose my info
everytime the page is changed.

Good Idea or not??
Jul 19 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Why don't you store the info in a database, and all you have to store in the
session is the primary key...

<fe**@fro.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
Hi,
I want to do things this way:

I have a bunch of stuff that I want to keep track of while a user is
connected to the site. Maybe 50 little peices of information.

So I know I can make 50 session variables , or an store an array in a
session variable, but what I wanna do is store it all in a class
so I can use property get and property let.

I want to store this class in a session variable so I don't lose my info
everytime the page is changed.

Good Idea or not??

Jul 19 '05 #2

P: n/a
>You would still have to store the class instance in a session variable .
That';s what I wanna do. I am just asking is it possible. I guess it must
be thanks. So I'll do it.
Your users can still whiz around your site if you just get it from the DB each page.

I don't wanna do that, I've done that for years. gotta be a better way

thanks
"Bob Lehmann" <no****@dontbotherme.zzz> wrote in message
news:e7****************@TK2MSFTNGP12.phx.gbl... You would still have to store the class instance in a session variable .
Your users can still whiz around your site if you just get it from the DB
each page.

Bob Lehmann

"Tammy B." <Tb@stinkylips.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi I am storing tons of info in a database.
It's all in a database. I just want to get the info once and let the user
whiz around the site with out having to look it up again on every page.

I could store it all in session varables, but it seems even better to

write
a class in an include file, and use property let and property set to
retrieve what I need.

Have you seen this before?

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:OK****************@tk2msftngp13.phx.gbl...
Why don't you store the info in a database, and all you have to store in
the
session is the primary key...

<fe**@fro.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
> Hi,
> I want to do things this way:
>
> I have a bunch of stuff that I want to keep track of while a user is
> connected to the site. Maybe 50 little peices of information.
>
> So I know I can make 50 session variables , or an store an array in

a > session variable, but what I wanna do is store it all in a class
> so I can use property get and property let.
>
> I want to store this class in a session variable so I don't lose my

info > everytime the page is changed.
>
> Good Idea or not??
>
>



Jul 19 '05 #3

P: n/a
> You would still have to store the class instance in a session variable .
Your users can still whiz around your site if you just get it from the DB
each page.


And I contend that using the DB would almost surely be more efficient, given
correct indexing and cleanup of obsolete data...
Jul 19 '05 #4

P: n/a
good to know.
And I contend that using the DB would almost surely be more efficient, given correct indexing and cleanup of obsolete data...
Ok what I am doing is close to a shopping basket.

Here's an example. Basically, if the session variable exists then use it,
otherwise go look it up.
Saves a trip to the database if not needed.
But it would be simpler to just have Current_vendor_name be a property of a
class.

Response.write getCurrent_VENDOR_NAME()

function getCurrent_VENDOR_NAME
if session("Current_VENDOR_NAME")="" then 'if session variable does not
exist then go look it up
sql = " Select VENDOR_NAME from user_settings where username='" &
getusername() & "'"
getrecordset(sql)
session("Current_VENDOR_NAME") =rs(0)
else
'if session variable does exist then do nothing
end if
getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME") 'return the
session variable
end function


"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:ue****************@TK2MSFTNGP12.phx.gbl...
You would still have to store the class instance in a session variable .
Your users can still whiz around your site if you just get it from the DB each page.


And I contend that using the DB would almost surely be more efficient,

given correct indexing and cleanup of obsolete data...

Jul 19 '05 #5

P: n/a
I would certainly consider caching this data locally on the server rather
than going back and forth to the database for it. I don't know if you'll be
able to store a class in Session or not, so I won't comment on that.

Have you considered using an xml document? You could save it to an xml file
instead of using Session, which has some drawbacks, especially if the user
is rejecting cookies.

Bob Barrows

Tammy B. wrote:
good to know.
And I contend that using the DB would almost surely be more
efficient, given correct indexing and cleanup of obsolete data...


Ok what I am doing is close to a shopping basket.

Here's an example. Basically, if the session variable exists then
use it, otherwise go look it up.
Saves a trip to the database if not needed.
But it would be simpler to just have Current_vendor_name be a
property of a class.

Response.write getCurrent_VENDOR_NAME()

function getCurrent_VENDOR_NAME
if session("Current_VENDOR_NAME")="" then 'if session variable
does not exist then go look it up
sql = " Select VENDOR_NAME from user_settings where
username='" & getusername() & "'"
getrecordset(sql)
session("Current_VENDOR_NAME") =rs(0)
else
'if session variable does exist then do nothing
end if
getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
'return the session variable
end function


"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:ue****************@TK2MSFTNGP12.phx.gbl...
You would still have to store the class instance in a session
variable . Your users can still whiz around your site if you just
get it from the DB each page.


And I contend that using the DB would almost surely be more
efficient, given correct indexing and cleanup of obsolete data...

Jul 19 '05 #6

P: n/a
Good idea. Probably the best Idea yet.
I am not there mentally yet, else I would not be pitchfork fighting in
Arron Bertrand hell right now.

He doesn't know if I'll be able to store a class in Session either.
Thank you.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...
I would certainly consider caching this data locally on the server rather
than going back and forth to the database for it. I don't know if you'll be able to store a class in Session or not, so I won't comment on that.

Have you considered using an xml document? You could save it to an xml file instead of using Session, which has some drawbacks, especially if the user
is rejecting cookies.

Bob Barrows

Tammy B. wrote:
good to know.
And I contend that using the DB would almost surely be more
efficient, given correct indexing and cleanup of obsolete data...


Ok what I am doing is close to a shopping basket.

Here's an example. Basically, if the session variable exists then
use it, otherwise go look it up.
Saves a trip to the database if not needed.
But it would be simpler to just have Current_vendor_name be a
property of a class.

Response.write getCurrent_VENDOR_NAME()

function getCurrent_VENDOR_NAME
if session("Current_VENDOR_NAME")="" then 'if session variable
does not exist then go look it up
sql = " Select VENDOR_NAME from user_settings where
username='" & getusername() & "'"
getrecordset(sql)
session("Current_VENDOR_NAME") =rs(0)
else
'if session variable does exist then do nothing
end if
getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
'return the session variable
end function


"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:ue****************@TK2MSFTNGP12.phx.gbl...
You would still have to store the class instance in a session
variable . Your users can still whiz around your site if you just
get it from the DB each page.

And I contend that using the DB would almost surely be more
efficient, given correct indexing and cleanup of obsolete data...


Jul 19 '05 #7

P: n/a
> He doesn't know if I'll be able to store a class in Session either.

Have you thought of, hmmm, I don't know, TRYING IT?
Jul 19 '05 #8

P: n/a
Well, seeing as how I'm on a roll ... :-)

For that matter, you can also use a disconnected recordset, which can also
be saved to a file and reopened as necessary. It can even be reconnected to
the database so any changes can be propogated to the database using
UpdateBatch.

HTH,
Bob Barrows

Tammy B. wrote:
Good idea. Probably the best Idea yet.
I am not there mentally yet, else I would not be pitchfork fighting
in Arron Bertrand hell right now.

He doesn't know if I'll be able to store a class in Session either.
Thank you.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...
I would certainly consider caching this data locally on the server
rather than going back and forth to the database for it. I don't
know if you'll be able to store a class in Session or not, so I
won't comment on that.

Have you considered using an xml document? You could save it to an
xml file instead of using Session, which has some drawbacks,
especially if the user is rejecting cookies.

Bob Barrows

Tammy B. wrote:
good to know.

And I contend that using the DB would almost surely be more
efficient, given correct indexing and cleanup of obsolete data...

Ok what I am doing is close to a shopping basket.

Here's an example. Basically, if the session variable exists then
use it, otherwise go look it up.
Saves a trip to the database if not needed.
But it would be simpler to just have Current_vendor_name be a
property of a class.

Response.write getCurrent_VENDOR_NAME()

function getCurrent_VENDOR_NAME
if session("Current_VENDOR_NAME")="" then 'if session variable
does not exist then go look it up
sql = " Select VENDOR_NAME from user_settings where
username='" & getusername() & "'"
getrecordset(sql)
session("Current_VENDOR_NAME") =rs(0)
else
'if session variable does exist then do nothing
end if
getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
'return the session variable
end function


"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:ue****************@TK2MSFTNGP12.phx.gbl...
> You would still have to store the class instance in a session
> variable . Your users can still whiz around your site if you just
> get it from the DB each page.

And I contend that using the DB would almost surely be more
efficient, given correct indexing and cleanup of obsolete data...

Jul 19 '05 #9

P: n/a
I did, but I can't get it to work.
So I need to know if it is something I am doing wrong , or if it is not
possible. That's why I to get someone WHO KNOWS to answer the question, and
to get YOU to STEP ASIDE

Will you keep me in your kill file
ps. have a good weekend

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
He doesn't know if I'll be able to store a class in Session either.


Have you thought of, hmmm, I don't know, TRYING IT?

Jul 19 '05 #10

P: n/a
holy moly that sounds good, I thought i was using a disconnected recordset.

save to what kind of file? text? xml? a recordset file? where on the client?
server?
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
Well, seeing as how I'm on a roll ... :-)

For that matter, you can also use a disconnected recordset, which can also
be saved to a file and reopened as necessary. It can even be reconnected to the database so any changes can be propogated to the database using
UpdateBatch.

HTH,
Bob Barrows

Tammy B. wrote:
Good idea. Probably the best Idea yet.
I am not there mentally yet, else I would not be pitchfork fighting
in Arron Bertrand hell right now.

He doesn't know if I'll be able to store a class in Session either.
Thank you.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...
I would certainly consider caching this data locally on the server
rather than going back and forth to the database for it. I don't
know if you'll be able to store a class in Session or not, so I
won't comment on that.

Have you considered using an xml document? You could save it to an
xml file instead of using Session, which has some drawbacks,
especially if the user is rejecting cookies.

Bob Barrows

Tammy B. wrote:
good to know.

> And I contend that using the DB would almost surely be more
> efficient, given correct indexing and cleanup of obsolete data...

Ok what I am doing is close to a shopping basket.

Here's an example. Basically, if the session variable exists then
use it, otherwise go look it up.
Saves a trip to the database if not needed.
But it would be simpler to just have Current_vendor_name be a
property of a class.

Response.write getCurrent_VENDOR_NAME()

function getCurrent_VENDOR_NAME
if session("Current_VENDOR_NAME")="" then 'if session variable
does not exist then go look it up
sql = " Select VENDOR_NAME from user_settings where
username='" & getusername() & "'"
getrecordset(sql)
session("Current_VENDOR_NAME") =rs(0)
else
'if session variable does exist then do nothing
end if
getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
'return the session variable
end function


"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:ue****************@TK2MSFTNGP12.phx.gbl...
>> You would still have to store the class instance in a session
>> variable . Your users can still whiz around your site if you just
>> get it from the DB each page.
>
> And I contend that using the DB would almost surely be more
> efficient, given correct indexing and cleanup of obsolete data...


Jul 19 '05 #11

P: n/a
Tammy B. wrote:
holy moly that sounds good, I thought i was using a disconnected
recordset.
You only have a disconnected recordset if you've opened it and subsequently
set its ActiveConnection property to Nothing (which explains its name ...)

save to what kind of file? text? xml? a recordset file? Either a proprietary recordset format file, or an xml file. See here:
http://msdn.microsoft.com/library/en...damth03_10.asp

where on the client? server?
I was thinking of saving it on the server. You won't be able to save a file
on the client machine due to security reasons, unless you go the HTA route
(HTML Application).

If you want to pass the recordset to the client page, you can do something
like this:

http://www.davidpenton.com/testsite/...ver2client.asp

If you change the recordset in client-side code (add or change data, that
is), passing the changed recordset back to a server-side page would require
saving it to an xml document and putting the xml document's xml into a
hidden textbox ... I've never done this part so I'm making this up as I go
.... :-) I don't see why it wouldn't work ...

Of course, the client machine will have to have a functioning MDAC
installation in order for any of this client-side stuff to work. This alone
may be enough to convince you to do ADO stuff on the server only.

It's a lot easier to pass an xml document to the client. See here:
http://www.davidpenton.com/testsite/...ta.islands.asp

HTH,
Bob Barrows



"Bob Barrows" <re*******@yahoo.com> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
Well, seeing as how I'm on a roll ... :-)

For that matter, you can also use a disconnected recordset, which
can also be saved to a file and reopened as necessary. It can even
be reconnected to the database so any changes can be propogated to
the database using UpdateBatch.

HTH,
Bob Barrows

Tammy B. wrote:
Good idea. Probably the best Idea yet.
I am not there mentally yet, else I would not be pitchfork
fighting in Arron Bertrand hell right now.

He doesn't know if I'll be able to store a class in Session either.
Thank you.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...
I would certainly consider caching this data locally on the server
rather than going back and forth to the database for it. I don't
know if you'll be able to store a class in Session or not, so I
won't comment on that.

Have you considered using an xml document? You could save it to an
xml file instead of using Session, which has some drawbacks,
especially if the user is rejecting cookies.

Bob Barrows

Tammy B. wrote:
> good to know.
>
>> And I contend that using the DB would almost surely be more
>> efficient, given correct indexing and cleanup of obsolete data...
>
> Ok what I am doing is close to a shopping basket.
>
> Here's an example. Basically, if the session variable exists then
> use it, otherwise go look it up.
> Saves a trip to the database if not needed.
> But it would be simpler to just have Current_vendor_name be a
> property of a class.
>
> Response.write getCurrent_VENDOR_NAME()
>
> function getCurrent_VENDOR_NAME
> if session("Current_VENDOR_NAME")="" then 'if session
> variable does not exist then go look it up
> sql = " Select VENDOR_NAME from user_settings where
> username='" & getusername() & "'"
> getrecordset(sql)
> session("Current_VENDOR_NAME") =rs(0)
> else
> 'if session variable does exist then do nothing
> end if
> getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
> 'return the session variable
> end function
>
>
>
>
> "Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
> news:ue****************@TK2MSFTNGP12.phx.gbl...
>>> You would still have to store the class instance in a session
>>> variable . Your users can still whiz around your site if you
>>> just get it from the DB each page.
>>
>> And I contend that using the DB would almost surely be more
>> efficient, given correct indexing and cleanup of obsolete data...

Jul 19 '05 #12

P: n/a
I may be wrong but I believe that VBScript classes cannot be stored in
session variables (sort of remember a Michael Harris post).
Also discussed here:
http://aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=195

A lot of the possibilitites discussed here seem a bit overly complex?

Here's my list of possible solutions:
An XML document (stored as a single string session variable) would do the
trick.
A WSC component (eg. same as a DLL but scripted code and no requirement to
recompile to make change) that either stores the data in session variable(s)
or a database. WSC's expose intellisense etc. to Interdev so they are a
slightly more complex version of VBScript classes that are also COM objects
in their own right.
A simple state VB DLL would also suffice (before I get flamed - I know there
are a multitiude of issues with *VB* DLLs in that they are apartment
threaded and give rise to all sorts of scaleability issues).
A stateless VB DLL (or hosted in MTS would be better) that stores and
retrieves from a database.
Data stored diretly in a database.

All of them have issues mostly concerning complexity, state management and
scaleability.

The simplest in my mind to achieve the required results would be an XML
document with the XML string stored in a single session variable (or
database for that matter). Also has the added benefit that it can be
communicated with from the client side (with client side XML support of
course).

Anyway - that's my meagre thoughts.

Cheers,

Chris.

"Tammy B." <Tb@stinkylips.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
I did, but I can't get it to work.
So I need to know if it is something I am doing wrong , or if it is not
possible. That's why I to get someone WHO KNOWS to answer the question, and to get YOU to STEP ASIDE

Will you keep me in your kill file
ps. have a good weekend

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
He doesn't know if I'll be able to store a class in Session either.


Have you thought of, hmmm, I don't know, TRYING IT?


Jul 19 '05 #13

P: n/a
Tammy B. wrote:
ok so I'm doing that. so I guess i need to save it as <another>
diconnected recordset - as a file ..?

? Another recordset?
No. Just save your disconnected recordset to a file. You'll have to use some
sort of naming scheme so you can identify the proper file. When the next
page opens, create a recordset object, check to see if the file exists. If
it does, instead of using a database connection to open it, use the file's
name in the Open statement. I think I posted an example of doing this in the
past week. Off to Google .... Here it is:
http://tinyurl.com/fz9p

HTH,
Bob Barrows
Jul 19 '05 #14

P: n/a
See the following:

http://msdn.microsoft.com/library/de...es_vb02_17.asp

I also have a VB class that retrieves disconnected recordsets - see the
ADODBFunctions class in:
http://ftp.belper.blue-canoe.net/rsaccess/rsaccess.zip

Chris.

"Tammy B." <Tb@stinkylips.com> wrote in message
news:u9**************@TK2MSFTNGP10.phx.gbl...
ok so I'm doing that. so I guess i need to save it as <another> diconnected recordset - as a file ..?
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:Og**************@TK2MSFTNGP12.phx.gbl...
Tammy B. wrote:
holy moly that sounds good, I thought i was using a disconnected
recordset.


You only have a disconnected recordset if you've opened it and

subsequently
set its ActiveConnection property to Nothing (which explains its name ....)

save to what kind of file? text? xml? a recordset file?

Either a proprietary recordset format file, or an xml file. See here:
http://msdn.microsoft.com/library/en...damth03_10.asp

where on the
client? server?


I was thinking of saving it on the server. You won't be able to save a

file
on the client machine due to security reasons, unless you go the HTA route (HTML Application).

If you want to pass the recordset to the client page, you can do something like this:

http://www.davidpenton.com/testsite/...ver2client.asp

If you change the recordset in client-side code (add or change data, that is), passing the changed recordset back to a server-side page would

require
saving it to an xml document and putting the xml document's xml into a
hidden textbox ... I've never done this part so I'm making this up as I go ... :-) I don't see why it wouldn't work ...

Of course, the client machine will have to have a functioning MDAC
installation in order for any of this client-side stuff to work. This

alone
may be enough to convince you to do ADO stuff on the server only.

It's a lot easier to pass an xml document to the client. See here:
http://www.davidpenton.com/testsite/...ta.islands.asp

HTH,
Bob Barrows



"Bob Barrows" <re*******@yahoo.com> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
> Well, seeing as how I'm on a roll ... :-)
>
> For that matter, you can also use a disconnected recordset, which
> can also be saved to a file and reopened as necessary. It can even
> be reconnected to the database so any changes can be propogated to
> the database using UpdateBatch.
>
> HTH,
> Bob Barrows
>
> Tammy B. wrote:
>> Good idea. Probably the best Idea yet.
>> I am not there mentally yet, else I would not be pitchfork
>> fighting in Arron Bertrand hell right now.
>>
>> He doesn't know if I'll be able to store a class in Session either.
>> Thank you.
>>
>>
>> "Bob Barrows" <re*******@yahoo.com> wrote in message
>> news:ex**************@TK2MSFTNGP12.phx.gbl...
>>> I would certainly consider caching this data locally on the server
>>> rather than going back and forth to the database for it. I don't
>>> know if you'll be able to store a class in Session or not, so I
>>> won't comment on that.
>>>
>>> Have you considered using an xml document? You could save it to an
>>> xml file instead of using Session, which has some drawbacks,
>>> especially if the user is rejecting cookies.
>>>
>>> Bob Barrows
>>>
>>> Tammy B. wrote:
>>>> good to know.
>>>>
>>>>> And I contend that using the DB would almost surely be more
>>>>> efficient, given correct indexing and cleanup of obsolete data...
>>>>
>>>> Ok what I am doing is close to a shopping basket.
>>>>
>>>> Here's an example. Basically, if the session variable exists then
>>>> use it, otherwise go look it up.
>>>> Saves a trip to the database if not needed.
>>>> But it would be simpler to just have Current_vendor_name be a
>>>> property of a class.
>>>>
>>>> Response.write getCurrent_VENDOR_NAME()
>>>>
>>>> function getCurrent_VENDOR_NAME
>>>> if session("Current_VENDOR_NAME")="" then 'if session
>>>> variable does not exist then go look it up
>>>> sql = " Select VENDOR_NAME from user_settings where
>>>> username='" & getusername() & "'"
>>>> getrecordset(sql)
>>>> session("Current_VENDOR_NAME") =rs(0)
>>>> else
>>>> 'if session variable does exist then do nothing
>>>> end if
>>>> getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
>>>> 'return the session variable
>>>> end function
>>>>
>>>>
>>>>
>>>>
>>>> "Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
>>>> news:ue****************@TK2MSFTNGP12.phx.gbl...
>>>>>> You would still have to store the class instance in a session
>>>>>> variable . Your users can still whiz around your site if you
>>>>>> just get it from the DB each page.
>>>>>
>>>>> And I contend that using the DB would almost surely be more
>>>>> efficient, given correct indexing and cleanup of obsolete data...



Jul 19 '05 #15

P: n/a
wahooo thanks guys

"Chris Barber" <ch***@blue-canoe.co.uk.NOSPAM> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
See the following:

http://msdn.microsoft.com/library/de...es_vb02_17.asp
I also have a VB class that retrieves disconnected recordsets - see the
ADODBFunctions class in:
http://ftp.belper.blue-canoe.net/rsaccess/rsaccess.zip

Chris.

"Tammy B." <Tb@stinkylips.com> wrote in message
news:u9**************@TK2MSFTNGP10.phx.gbl...
ok so I'm doing that. so I guess i need to save it as <another> diconnected
recordset - as a file ..?
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:Og**************@TK2MSFTNGP12.phx.gbl...
Tammy B. wrote:
> holy moly that sounds good, I thought i was using a disconnected
> recordset.

You only have a disconnected recordset if you've opened it and

subsequently
set its ActiveConnection property to Nothing (which explains its name ...)
>
> save to what kind of file? text? xml? a recordset file?
Either a proprietary recordset format file, or an xml file. See here:
http://msdn.microsoft.com/library/en...damth03_10.asp

where on the
> client? server?

I was thinking of saving it on the server. You won't be able to save a

file
on the client machine due to security reasons, unless you go the HTA route (HTML Application).

If you want to pass the recordset to the client page, you can do something like this:

http://www.davidpenton.com/testsite/...ver2client.asp
If you change the recordset in client-side code (add or change data, that is), passing the changed recordset back to a server-side page would

require
saving it to an xml document and putting the xml document's xml into a
hidden textbox ... I've never done this part so I'm making this up as I go
... :-) I don't see why it wouldn't work ...

Of course, the client machine will have to have a functioning MDAC
installation in order for any of this client-side stuff to work. This

alone
may be enough to convince you to do ADO stuff on the server only.

It's a lot easier to pass an xml document to the client. See here:
http://www.davidpenton.com/testsite/...ta.islands.asp

HTH,
Bob Barrows
>
>
> "Bob Barrows" <re*******@yahoo.com> wrote in message
> news:u$**************@TK2MSFTNGP12.phx.gbl...
>> Well, seeing as how I'm on a roll ... :-)
>>
>> For that matter, you can also use a disconnected recordset, which
>> can also be saved to a file and reopened as necessary. It can even
>> be reconnected to the database so any changes can be propogated to
>> the database using UpdateBatch.
>>
>> HTH,
>> Bob Barrows
>>
>> Tammy B. wrote:
>>> Good idea. Probably the best Idea yet.
>>> I am not there mentally yet, else I would not be pitchfork
>>> fighting in Arron Bertrand hell right now.
>>>
>>> He doesn't know if I'll be able to store a class in Session

either. >>> Thank you.
>>>
>>>
>>> "Bob Barrows" <re*******@yahoo.com> wrote in message
>>> news:ex**************@TK2MSFTNGP12.phx.gbl...
>>>> I would certainly consider caching this data locally on the server >>>> rather than going back and forth to the database for it. I don't
>>>> know if you'll be able to store a class in Session or not, so I
>>>> won't comment on that.
>>>>
>>>> Have you considered using an xml document? You could save it to an >>>> xml file instead of using Session, which has some drawbacks,
>>>> especially if the user is rejecting cookies.
>>>>
>>>> Bob Barrows
>>>>
>>>> Tammy B. wrote:
>>>>> good to know.
>>>>>
>>>>>> And I contend that using the DB would almost surely be more
>>>>>> efficient, given correct indexing and cleanup of obsolete data... >>>>>
>>>>> Ok what I am doing is close to a shopping basket.
>>>>>
>>>>> Here's an example. Basically, if the session variable exists then >>>>> use it, otherwise go look it up.
>>>>> Saves a trip to the database if not needed.
>>>>> But it would be simpler to just have Current_vendor_name be a
>>>>> property of a class.
>>>>>
>>>>> Response.write getCurrent_VENDOR_NAME()
>>>>>
>>>>> function getCurrent_VENDOR_NAME
>>>>> if session("Current_VENDOR_NAME")="" then 'if session
>>>>> variable does not exist then go look it up
>>>>> sql = " Select VENDOR_NAME from user_settings where
>>>>> username='" & getusername() & "'"
>>>>> getrecordset(sql)
>>>>> session("Current_VENDOR_NAME") =rs(0)
>>>>> else
>>>>> 'if session variable does exist then do nothing
>>>>> end if
>>>>> getCurrent_VENDOR_NAME= session("Current_VENDOR_NAME")
>>>>> 'return the session variable
>>>>> end function
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
>>>>> news:ue****************@TK2MSFTNGP12.phx.gbl...
>>>>>>> You would still have to store the class instance in a session
>>>>>>> variable . Your users can still whiz around your site if you
>>>>>>> just get it from the DB each page.
>>>>>>
>>>>>> And I contend that using the DB would almost surely be more
>>>>>> efficient, given correct indexing and cleanup of obsolete data...



Jul 19 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.