there is a thread for each current request, with one exception. only one
active request per session is allowed (others are queued). also during the
processing of the page, the request thread may change.
if you use static data (shared across threads) then you must use locking. in
your example, you need to do some sort of locking, as if two users insert at
the same time, they can both get the id back. you can lock in your aspx code
(not the best), or you can lock at the database level if you are using a
database like db2, sqlserver or oracle, though the techique will be
different for each.
-- bruce (sqlwork.com)
"Andrea" <googlegroups@fuck_the_spam_cleanmail.it> wrote in message
news:9f*************************@news.microsoft.co m...
Suppose a base class like
partial class X : Page ...
and a class A that is called from class X somewhere along the code.
I'm not able to understand if for each user connected to the web site, a
thread is created and so every call to class A stay in different thread or
all works into a single thread.
I'm asking this because I've a function the get the last ID of a table in
the db, but I'm worried about that multiple call can return the same
number at same time (since I just get the number) and after I increment
it.
What could be a solution? In a multiple thread scenario, the lock
statement sounds good ... but I'm not sure about the scenario it
represents.
Thanks
Andrea