> > > That's only reliable inside a transaction. Don't leave that > > > part out. > > > > Actually, depending on your database, a transaction may not > > be required just as Barney states. For example, if you're > > using MS Access, the entire table is locked when you write > > to it, so a transaction wouldn't be required. > > Yes, but wouldn't there be a possibility that someone could > sneak in and do an insert between the time that you do the > insert and then select for the last auto_increment?
Not if you use the database's own transaction-safe mechanism for selecting the ID, such as "SELECT @@IDENTITY ...". That's what Barney was suggesting, I think. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192466 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

