SC
|
| Posted: 06/17/2002, 12:57 AM |
|
I have added some code to the afterinsert event of a record form to add a related record into another table. This all works except that the autoincrement key of the primary form isn't available at the time the afterinsert event is executed (it's on the database).
Is there any way of getting the autoincremented key at this point? I could select max() for it but this would not allow concurrency.
Afterinsert code.
global $wars1,$newwid;
$results_ds = new clsDBLeague();
$sSQL2 = "INSERT INTO results ("
. "sid, "
. "wid, "
. "cid, "
. "pts"
. ") VALUES ( "
. $wars1->ds->ToSQL($wars1->ds->Season->GetDBValue(), $wars1->ds->Season->DataType) . ", "
. $wars1->ds->ToSQL($wars1->ds->wid->GetDBValue(), $wars1->ds->wid->DataType) .","
. $wars1->ds->ToSQL($wars1->ds->Clan1->GetDBValue(), $wars1->ds->Clan1->DataType) . ", "
. $wars1->ds->ToSQL($wars1->ds->cid1pts->GetValue(), $wars1->ds->cid1pts->DataType)
.")";
$results_ds->query($sSQL2);
|
|
|
 |
Nicole
|
| Posted: 06/18/2002, 6:39 AM |
|
Hello,
what db do you use? Please refer to following article: http://www.gotocode.com/art.asp?art_id=80&
hope it helps
|
|
|
 |
|