Graham Pearson
|
Posted: 11/02/2005, 11:37 AM |
|
On this Event, is their a function that will give me the Primary Key of
the record which was just inserted into a table. I am trying to retrieve
this number so I can send an email about this newly inserted record of a
table.
|
|
|
peterr
Posts: 5971
|
Posted: 11/02/2005, 11:49 AM |
|
There is no such function because each application and database may handle this differently, while some databases may not provide such key at all.
However, there is related example in CCS Example Pack: "Multi-Step User Registration".
When a user enters his information on Step 1, a record is created in the database, the application retrieves the last inserted key, then redirects the user to Step 2 while passing the newly created user_id to it.
You can review the related ColdFusion event to see how it was implemented.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
E43509
Posts: 283
|
Posted: 11/02/2005, 12:21 PM |
|
There was a lot of talk on this in the old forums. Here a link to one of the tips: http://www.gotocode.com/art.asp?art_id=222&
If your backend is oracle, life is easy, just grab the sequence.next_val before doing the insert (select myseq.next_val from dual) and put that in your PK field.
|
|
|
|