Display newrecord id = -1

Cajunspirit

Member
Joined
Sep 29, 2008
Messages
19
Programming Experience
Beginner
Is there any way to get the value that the Database generates?

I'm trying to make my system easier to use.

4 tables. Where the Job table's Job_no is the foreign key in 2 other tables.
Thus to create a new record for these other tables, it needs the correct foreign key.

I was hoping to use a label that accepts the value that updates the database for the job_no so that it could be referenced to as the value for the foreign key in the other tables... to no avail...
 
Are you using a dataset? If set up properly the dataset keys should update appropiately after you update the data to the database.
 
All of my keys are
Autoincrement True
AutoincrementSeed -1
AutoincrementStep -1

This should work properly for you, returning the correct foreign keys to your dataset after you update to the database.

If your dataset key relations are setup correctly, when you add a child record it should automatically be set to the same key as the parent record in the dataset. Is this not the case?

After you do an update to the database from the dataset these values (the negative keys) should be replaced with the database's autoincrement keys.

Let me know where exactly this is not working.
 
There is a checkbox in the advanced section of the tableadapter configuration wizard titled "refresh the data table"

Have you ticked it?
 

Latest posts

Back
Top