English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Environments: SQL server 2000, .net 2.0
In normal case, i create a invoice then create detail invoice by the ID of newest record in invoice table. But if in the below situation, I need a solution. Can you help me?
1. User 1 create record A in invoice table.
2. User 2 create record B in the invoice table.
3. Then User create record C in detail invoice table by ID of newest record (B in this situation).
--> Wrong expectation.
I guess we should have these solutions, but which one is the best and is there some sol better?:
- Use @@Identify after create record in invoice table.
- Use customize ID.

2006-11-19 15:32:46 · 2 answers · asked by quoc_phan_logigear 1 in Computers & Internet Programming & Design

2 answers

never insert the detail record in 'Detail Invoice' table base on ID of the newest record in 'Invoice' Table.

Use temporary table to record your Invoice Details first and post it to 'Detail Invoice' with same ID with your 'Invoice' ID.

2006-11-20 05:30:09 · answer #1 · answered by Manzana verde 5 · 0 0

In most cases, a table *should* have Identity as its primary keyfield, and then get linked to other table(s) via other field(s) and secondary indices.

The other possibility is code a stored procedure to automatically create a place-holder empty reocrd in invoice-detail table the moment you create a record in invoice table, but that could lead to further confusion.

2006-11-19 17:30:06 · answer #2 · answered by Kasey C 7 · 0 0

fedest.com, questions and answers