Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Begin tran...end tran insert into table
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00246039
Message ID:
00246063
Views:
17
>do while !EOF()
> begin tran
> insert into .....
> end tran
>enddo

Shawn,

The code above will never exit the loop, there is no skip in it. Also your use of a transaction is totally unhelpful to your objective. Wrapping a single operation in a transaction does not add anything to the operation. Try something like this;
LOCAL llFailed
BEGIN TRANSACTION
SCAN
   INSERT INTO ...
   IF NOT TableUpdate(...)
      * Operation failed
      llFailed = .T.
      EXIT
   ENDIF
ENDSCAN
IF llFailed
   * Something went wrong so undo the whole thing
   ROLLBACK
ELSE
   * All is ok, committ
   ENDTRANSACTION
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform