[thelist] Key ID of Record Just Created?

Ken Schaefer ken.schaefer at gmail.com
Sat Aug 27 03:37:33 CDT 2005


On 8/25/05, VOLKAN ÖZÇELİK <volkan.ozcelik at gmail.com> wrote:
> >
> > Provided you're not using an application server or abstraction layer that
> > uses connection pooling, in which case you may be using the same connection
> > for multiple queries.
> 
> I don't quite know how things are implemented on the M$ side.
> Surely, Ken knows better.

In OLEDB (for ASP) / SQLClient (ASP.NET) world your upper layer is
handed a stub by the connection pool manager when you instantiate a
connection object. When actually open the connection, you are given a
real connection from the pool. Provided you keep using that
connection, you'll get the correct identity value. When you call
.Close, the connection is returned to the pool, and the pool manager
calls a function to "reset" the connection, essentially resetting the
scope of the connection. So that the next time that connection is
used, the correct identity will be returned.

Cheers
Ken


More information about the thelist mailing list