Master-detail and auto-increment fields 
Author Message
 Master-detail and auto-increment fields

Hi there,

When using autoincrement fields (as the primary key), is there a way to
find out the newly generated number after doing an insert?

When implementing a master detail relation with the auto-inc. field in the
master, the detail lines need to retrieve the key from the master table.
This value does not seem to be available. Not even after a post within a
transaction.

We have tried this using InterBase, Paradox and Sybase system 11.

Please let us know if there is an answer to this. Are auto-inc. fields not
suitable for use in master detail relationships?????





Tue, 15 Dec 1998 03:00:00 GMT  
 Master-detail and auto-increment fields

Quote:
>Hi there,
>When using autoincrement fields (as the primary key), is there a way to
>find out the newly generated number after doing an insert?
>When implementing a master detail relation with the auto-inc. field in the
>master, the detail lines need to retrieve the key from the master table.
>This value does not seem to be available. Not even after a post within a
>transaction.
>We have tried this using InterBase, Paradox and Sybase system 11.
>Please let us know if there is an answer to this. Are auto-inc. fields not
>suitable for use in master detail relationships?????

Personally, I wouldn't do it, especially in a multi-user setting.  I
would store the "next number" as a field in a separate table and
increment it delphically.


Tue, 15 Dec 1998 03:00:00 GMT  
 Master-detail and auto-increment fields

In the delphi class I went thru they said Paradox auto-increment fields dont
work with Delphi 2.0.

You must manually implement a solution to query out a max id, then increment it
yourself.

One way is to keep a separate key table, and when you need to add a new record,
lock this table, edit record, increment, post. Then you own that number for the
duration.

Good luck...

--
Joe Healy - Tampa / St Petersburg FL


Quote:

>Hi there,

>When using autoincrement fields (as the primary key), is there a way to
>find out the newly generated number after doing an insert?

>When implementing a master detail relation with the auto-inc. field in the
>master, the detail lines need to retrieve the key from the master table.
>This value does not seem to be available. Not even after a post within a
>transaction.

>We have tried this using InterBase, Paradox and Sybase system 11.

>Please let us know if there is an answer to this. Are auto-inc. fields not
>suitable for use in master detail relationships?????






Sun, 20 Dec 1998 03:00:00 GMT  
 Master-detail and auto-increment fields

Quote:


>Subject: Re: Master-detail and auto-increment fields
>Date: 3 Jul 1996 20:19:43 GMT

After some effort, I have in Delphi 1 a Master- detail with Paradox tables in
which the primary key of the master fields IS an autoincrement. The primary
key of the detail tables is comprised of "DetailFieldA", "MasterKeyField",
and this works fine for my one to many needs. The master-detail relationship
is set in the Table properties in Delphi, not in the Paradox table structure
per se. I post the master table immediately after inserting a record- this
posts the autoinc number right away before filling in the user entered data,
and lets you then work on the detail tables. The main deficit I've heard is
the potential loss of key numbers if the table becomes damaged, but otherwise
I have been satisfied with using the Paradox autoinc as a master.

-Larry Ward, MD



Tue, 22 Dec 1998 03:00:00 GMT  
 Master-detail and auto-increment fields


Quote:

> After some effort, I have in Delphi 1 a Master- detail with Paradox
tables in
> which the primary key of the master fields IS an autoincrement. The
primary
> key of the detail tables is comprised of "DetailFieldA",
"MasterKeyField",
> and this works fine for my one to many needs. The master-detail
relationship
> is set in the Table properties in Delphi, not in the Paradox table
structure
> per se. I post the master table immediately after inserting a record-
this
> posts the autoinc number right away before filling in the user entered
data,
> and lets you then work on the detail tables. The main deficit I've heard
is
> the potential loss of key numbers if the table becomes damaged, but
otherwise
> I have been satisfied with using the Paradox autoinc as a master.

Playing with fire........


Fri, 25 Dec 1998 03:00:00 GMT  
 Master-detail and auto-increment fields

Quote:



>> After some effort, I have in Delphi 1 a Master- detail with Paradox
>tables in
>> which the primary key of the master fields IS an autoincrement. The
>primary
>> key of the detail tables is comprised of "DetailFieldA",
>"MasterKeyField",
>Playing with fire........

No. It is Russian Roulette with 5 live rounds and one empty!

Jouko



Tue, 29 Dec 1998 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Auto Increment Fields and Master Details Relationship

2. Autoincrement fields and Master-Detail joins

3. Master/Detail lookup - losing detail field

4. Auto increment field

5. Need help defining auto-incrementing field using TTable.Create

6. Question about auto increment field

7. MS Access Auto incrementing Key fields

8. Delphi 2 SQL Server 6 problem with identifier (auto-increment) fields

9. Auto-increment fields - Should I Use Them?

10. Obtaining value of Paradox's Auto-Incremented Field Type

11. How to reset auto- increment Fields

12. Auto-increment fields

 

 
Powered by phpBB® Forum Software