Inserting new DB-Record: Get Value of AutoValue field? 
Author Message
 Inserting new DB-Record: Get Value of AutoValue field?

Hi!

I guess this is a simple problem, but I haven't found any answers:

My program adds a new record (using CRecordset derived class) into my
database. The record has an autovalue field (name: id) which is set
automatically by the database. How can I _safely_get the value of this field
for using it in an other table as reference?

The first idea I had was to select the records order by the id and get the
record with the highest id. This works fine as long as only one program uses
this table at the same time. But I'd like to have lots of users who can add
records any time.

I'm sure there must be a way because this should be a "normal" problem
having a table which is referenced by an other table (e.g. a "CD-List" and a
"Title List" table, where the titles refer to the CD id).

Thank you for your help!

Ciao,
  Alex

-



Tue, 30 Jul 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Inserting new DB-Record: Get Value of AutoValue field?

2. Getting key field value after insert

3. Inserting records into large VFP6 DB causes error in VFPODBC

4. Insert a record w/ a datetime field using ODBC calls

5. Problem inserting binray field from VC++6.0 using ADO to SQL7,0 DB

6. Problems with OLE DB and ODBC getting record counts in C++

7. inserting a value for the datetime field using ado in vc++

8. Update record Field value problem

9. how to insert value of BLOB into a memo field

10. Question about inserting new record

11. Updating/Adding a new record that already exists in the db

12. DAO: Setting OLE Object Field Value in Access DB

 

 
Powered by phpBB® Forum Software