
Getting key field value after insert
I have a table that has only one unique key field that increases
automatically when a new record is added.
In order to get a hold of this value after inserting a record I use:
sSql.Format("SELECT * from UTBMOTT WHERE sPersnr = '%s' ORDER BY lMottagare
DESC", m_szPersnr);
rs->Open(CRecordset::dynaset, sSql))
......
rs->AddNew();
rs->>Update();
rs->MoveLast();
and after this I can retrieve the key field value.
When I open the recordset I don't really want it to contain any records.
Is there a way to open the recordset without any records in it and still be
able to use it to retieve the key feild value ? Or is there an easier way to
get a hold of the key field value ?
Thanks in advance,
Pernilla