On 12/15/2020 12:59 PM, MB Software Solutions, LLC wrote:
VFP9SP2 - Citrix/VMWare server, Win10 desktop image on client

My error handling tripped on this simple line:

                        INSERT INTO broker!doclinks (ifileid,idoctypeid,crange) VALUES (thisform.oFile.iid,liDocTypeID,ALLTRIM(loObj.txtRange.value))

VFP Help says this about Error 108:

   Visual FoxPro 9.0 SP2
   File is in use by another user (Error 108)
You have attempted a USE, DELETE, or RENAME command on a file that is being used by another user on a network.


I don't see why this line of code would throw an Error 108. I guess I'll add a simple TRY/CATCH around it to retry it "N" number of times (via DO WHILE loop with flag and counter), but tossing this out to the group for your thoughts.

Thanks,
--Mike


I wrapped this code around it:

                        *** mjb 12/15/2020 - added try/catch and retry attempts
                        llPass = .F.
                        liTries = 0
                        DO WHILE NOT llPass AND liTries < 10
                            TRY
                                liTries = liTries + 1
                                INSERT INTO broker!doclinks (ifileid,idoctypeid,crange) VALUES (thisform.oFile.iid,liDocTypeID,ALLTRIM(loObj.txtRange.value))
                                llPass = .T.
                            CATCH TO loException WHEN loException.ErrorNo = 108                                 WAIT WINDOW TIMEOUT 1 "Unable to insert document link.  Reattempting " + ALLTRIM(STR(10-liTries)) + " more times..."
                                INKEY(2) && wait 2 seconds
                            CATCH TO loException
oUtils.Alert(loException.Message,16,"Problem inserting doc link")
                            ENDTRY
                        ENDDO && WHILE NOT llPass AND liTries < 10


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/2d6242d0-76c9-b166-2cfc-b62eff419...@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to