> InvoiceNo in Invoices is an autonumber. In my application,
> i want the number to be availed only after the user clicks Save button.
> As such i have used batch updates (ADO). The form seems to work fine
> when the user is adding the invoice items, but when one clicks Save,
> the invoice items disappear. The save button has two lines of code to
> save the changes:

This problem is one of the reasons I avoid using autoincrement columns.
The items disappear because, by using an autoincrement column, you are 
having the DBMS assign a key without your application knowing what the 
assigned key is.

Instead, I use the transaction capability of the DBMS to first find the 
InvoiceNo (SELECT MAX(InvoiceNo) FROM Invoices), then use that InvoiceNo 
for the INSERT INTO Invoices, then insert the lines. If you include all 
these statement within a single transaction, either all or none will 
execute. You can then return the InvoiceNo used so the application can 
access the saved rows.

Glenn Lawler



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to