As HTH said, you can get the id just created, but I know of no way to get the one that would be next used. I don't think there is a way to even be sure you'd get the right one with a multi-user app.
So I suggest you insert your master record first, get the id in the way HTH suggested, then insert your related records. Good luck On Nov 28, 2007, at 8:07 PM, Christopher Lavie wrote: > I am using ColdFusion MX 7.0 with a MySQL database. > > One of my tables has an autoincrement field called > "intKey" (without the quotes, obviously) as the key. > > Is there a way to programatically determine the number of the next > record that will be added to the database? > > For example, if I have ten records (with keys of 1 through 10) and > I delete records 8, 9, and 10, the next record that will be > inserted will be 11. Therefore it's not a matter of using the Max > (intKey) function and adding 1, because that would say that the > next record will be 8 instead of 11. > > Is there something I am missing here? > > Thanks! > > Chris > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3173 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
