Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File in use by another Error Message
Message
From
24/05/1999 18:29:24
 
 
To
24/05/1999 18:10:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00222087
Message ID:
00222261
Views:
15
OK, here's what I'm doing, and as I said, I know I'm handling this wrong, but it shouldn't matter as far as this error goes (but who knows, maybe it does?)

As soon as the user starts editting (by typing in the field), I issue a BEGIN TRANSACTION. There is more than one table involved and that's why I'm using transactions. I realize now that it should only be the TABLEUPDATE/TABLEREVERT that's enveloped in the transaction, but I didn't know that when I first coded this. AFAIK, the only negative aspect of doing it this way is that probably the records are locked for longer than they need to be. At this point, I don't care about that (as I said, I'll fix it later ... the user wants it yesterday < g >)

IF they save, then I do a TABLEUPDATE and an END TRANSACTION (redundant?). If they cancel, I do a ROLLBACK.

It seemed to be working fine for awhile, but I probably didn't try adding/canceling a few times in a row when I was initially testing it.

Do you think I'm not letting go of all of the record locks? Is that what you're getting at? After the ROLLBACK, I do an UNLOCK ALL (I think it was because of another problem tho, that I added that in). I'm sure the ROLLBACK is supposed to unlock all the records, but I don't think it is. IAC, the problem isn't locked records, I'm pretty sure about that.




>Hi, Bonnie-
>
>You are using buffering by virtue of the pessimistic buffering, so you *have* to use either a tableupate or a tablerevert. Also, the buffering is a totally separate issue from transactions.
>
>You might want to clear the transaction out of the mix at this point--especially if you are only updating one table or if updates in one table don't depend on another tables updates.
>
>In any case, transaction code might look something like this:
>
* Do some stuff to your data
>
>BEGIN TRANSACTION
>IF TABLEUPDATE(.T.,.T.,'cMyTable')
>  END TRANSACTION
>ELSE
>  ROLLBACK
>  TABLEREVERT( .T., 'cMyTable' )
>ENDIF
>
>If your code in your cancel isn't too long, would it make sense to post the relevant part of it?
>
>>1) Well, there is a grid on the form, but the table in question is not bound to it.
>>
>>2) Haven't tried saving instead of canceling (didn't want to put a lotta records on the tables). I'll check it out.
>>
>>3) I'm using transactions (and I already know I'm doing it wrong at this point, if I get a chance I'll change it) and so I'm doing a ROLLBACK. I didn't think to try that from the command window after the program suspends with the error. I'll check it out.
>>
>>4) I'm using default datasessions.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform