I have this part of code i fill two recordset in to same routine, and i want to use begintrans committ... rolbaktrans..ecc:
is correct code1 or code2
code1
conn.begintrans
.....
rs.addnew
rs.=fff
..
rs.update
conn.committ
begintrans ...
rs1.addnew
rs1.=fff
..
rs1.update
....
conn.committ
error trap:
conn.rollbacktrans
code2
conn.begintrans
.....
rs.addnew
rs.=fff
..
rs.update
...
rs1.addnew
rs1.=fff
..
rs1.update
....
conn.committ
error trap:
conn.rollbacktrans
BEGINTRANS, COMMIT ECC...
-
- Administrator
- Posts: 78589
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: BEGINTRANS, COMMIT ECC...
It depends on what you want.
If something goes wrong while rs1 is being updated, the first routine will undo only the changes to rs1, but those to rs will remain. The second routine will undo the changes to both rs and rs1.
YOU will have to decide what is best for your situation.
If something goes wrong while rs1 is being updated, the first routine will undo only the changes to rs1, but those to rs will remain. The second routine will undo the changes to both rs and rs1.
YOU will have to decide what is best for your situation.
Best wishes,
Hans
Hans