Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dao recordset in Coldfusion

Status
Not open for further replies.

mrsbean

Technical User
Jul 14, 2004
203
US
I want to retrieve the autonumber value of a record that was just added to the database. The value would be added by one administrator (unlikely, nearly impossible for more than one administrator to enter records at the same time). I want to use that autoumber to add some related records in other tables. I read a few things today about a dao recordset. I don't know the syntax for using this in Coldfusion. Can anyone point me toward some resources where I can learn how to do it?

MrsBean
 
I would definitely stick with the "Part 2: Platform-Specific Solutions" in that article. Querying a database a second time to retrieve something that the database could have automatically given you in the first query is pointless and just bad coding practice.

Although, the article's author needs to brush up on his SQL Server skills. You're supposed to use Scope_Identity() in this case, not @@identity.



Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
You can read more about Scope_Identity() vs. @@identity here:

ECAR, though I have to admit i've been using the @@identity, and i've seen countless other CF developers use this synatx in the same manner. Might be time I switched over the the correct syntax.

____________________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top