I am writing a ‘preview’ for a report that already exists. As it is programmed now, generating the report changes the Database (it generates an invoice for an order, then generates the report).
Now i need a way to generate the report without changing the database.
Generating a invoice is easier than deleting it, so i was thinking along these lines :
- start transaction
- make invoice
- read data into object (dataset)
- rollback transaction
- feed dataset to report
Is this a good approach? I’m asking because it doesn’t ‘seem’ like the right way to use a transaction.
thanks everybody!!!
This is not an advisable solution. You’ll be creating locks on tables and bashing the log unecessarily. The whole idea seems extremely unscalable.
Could you recode to separate the
GenerateInvoiceandGenerateReportcode into separate stored procedures? Then either call them separately or add anotherDoBothstored procedure?