Question for the experts: recordset threading model

Question for the experts: recordset threading model

am 07.03.2005 19:10:01 von DrLovely

I did a registry search and found that the threadingmodel for the
ADODB.recordset class is "both"...

Becuase of this, Is it not true that I should be able to use a
recordset object well and efficiently if I store it in a session
object in order to reference that object on all my asp page calls? The
recordset will have a very small amount of data in it.

(In contrast, the Dictionary object is frowned upon for storage in a
session variable because it is apartment threaded.)

Any answer is appreciated.

Re: Question for the experts: recordset threading model

am 07.03.2005 19:49:56 von reb01501

DrLovely@. wrote:
> I did a registry search and found that the threadingmodel for the
> ADODB.recordset class is "both"...

Really? By default, it should be "Apartment" ... at least it was in earlier
versions of ADO. Maybe that's changed. I do know that "Apartment" provides
better performance. Also, "Both" is not recommended if using a Jet database
due to Jet's threading model.
>
> Becuase of this, Is it not true that I should be able to use a
> recordset object well and efficiently if I store it in a session
> object in order to reference that object on all my asp page calls? The
> recordset will have a very small amount of data in it.

Yes. However, there are more efficient data structures that can be used:
arrays, xml, etc. Why do you wish to use a recordset?

>
> (In contrast, the Dictionary object is frowned upon for storage in a
> session variable because it is apartment threaded.)
>
Correct.
You can read more about it here:
http://www.aspfaq.com/show.asp?id=2053

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: Question for the experts: recordset threading model

am 07.03.2005 20:12:51 von DrLovely

On Mon, 7 Mar 2005 13:49:56 -0500, "Bob Barrows [MVP]"
wrote:

>DrLovely@. wrote:
>> I did a registry search and found that the threadingmodel for the
>> ADODB.recordset class is "both"...
>
>Really? By default, it should be "Apartment" ... at least it was in earlier
>versions of ADO. Maybe that's changed. I do know that "Apartment" provides
>better performance. Also, "Both" is not recommended if using a Jet database
>due to Jet's threading model.
>>
>> Becuase of this, Is it not true that I should be able to use a
>> recordset object well and efficiently if I store it in a session
>> object in order to reference that object on all my asp page calls? The
>> recordset will have a very small amount of data in it.
>
>Yes. However, there are more efficient data structures that can be used:
>arrays, xml, etc. Why do you wish to use a recordset?

I want to use the recordset as the shopping cart. I could just create
an empty recordset object and add my fields (prodID / quant), then use
ado for updates and deletes, addnew, etc. Then it could just float
around in session until I dump it in the actual table. I don't want
to write/update/delete all the time to the .mdb file ... corruption
possibly?

In the end, XML is just a string, and eventhough the DOM is available
it is still more trouble. An array only offers an ordinal lookup, I
think...

>
>>
>> (In contrast, the Dictionary object is frowned upon for storage in a
>> session variable because it is apartment threaded.)
>>
>Correct.
>You can read more about it here:
>http://www.aspfaq.com/show.asp?id=2053
>
>Bob Barrows