saving and updating records

  • Thread starter Thread starter frank
  • Start date Start date
F

frank

Hello,

I've created a database for tracking invoices and have a
couple design questions about how to cancel and save
records. I've created 2 temp tables (temp_Invoice,
temp_InvoiceDetails) that are used for modifying or adding
Invoices before populating the main database.

If a user chooses to modify a invoice, I have a proceedure
that copies the data into the temp tables. If they choose
not to save the record I simply delete the information in
the temp table. Once the data is ready to be put into the
main database its validated and then inserted or updated
using transactions. Is this the proper way of doing this?
Also, If a invoice detail is modified in the temp table,
how would i only update the field that changed in the main
table rather then looping through the recordset and
updating every record?

Thanks
 
frank said:
Hello,

I've created a database for tracking invoices and have a
couple design questions about how to cancel and save
records. I've created 2 temp tables (temp_Invoice,
temp_InvoiceDetails) that are used for modifying or adding
Invoices before populating the main database.

If a user chooses to modify a invoice, I have a proceedure
that copies the data into the temp tables. If they choose
not to save the record I simply delete the information in
the temp table. Once the data is ready to be put into the
main database its validated and then inserted or updated
using transactions. Is this the proper way of doing this?

Sounds reasonable to me, though I'm not familiar enough with your
database and your business constraints to say anything concrete.
Also, If a invoice detail is modified in the temp table,
how would i only update the field that changed in the main
table rather then looping through the recordset and
updating every record?

I don't follow you. I wouldn't expect you to be using a recordset, but
rather SQL statement executed directly; and if you are using a
recordset, why would you be updating every record? You said *one*
invoice detail was changed. Furthermore, the way you've described doing
this implies to me that you would never be *updating* records in the
live tables; rather, I'd expect you to update an invoice by deleting it
and all records relating it, then inserting all the records from the
temp tables -- all within a transaction so you could back it out if need
be.
 
Back
Top