Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to retry a command on error in a COM
Message
From
21/03/2007 08:56:10
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01206469
Message ID:
01206474
Views:
10
This message has been marked as a message which has helped to the initial question of the thread.
Hi Bret Try the following
.....
   PROCEDURE Method1
     Local llCont as Boolean, loEx as Exception
     llCont = .t.
     DO WHILE llCont
     	TRY     
            This.Open()
            llCont = .f.
        CATCH TO loEx
            IF loex.ErrorNo = 1748
        	EXIT
            ELSE
        	THROW loEx
            ENDIF
       	ENDTRY
     ENDDO
   ENDPROC
....
>What I have is a Method in a COM that calls another procedure. This procedure is generating an error that Microsoft says is erroneous and just to RETRY the command after the error. With error handling in a COM being somewhat confusing to me. I would like some education on the best way to do this. The below prg is set up basically like what I need. Method1 calls another Method that opens the database. What I would like to do is to place code around the This.Open() call that would somehow trap for an error number 1748 and when this happens to RETRY the command again. I would like this trap to not interfere with any other method or error trapping that is already in place. If anyone has a solution for this or input I would appreciate any input.
>
>TIA
>
>
>DEFINE CLASS MyClass AS Custom
>
>   PROCEDURE Method1
>
>     This.Open()
>
>   ENDPROC
>
>   PROCEDURE Method2
>      .....
>      This.Save()
>      .....
>   ENDPROC
>
>   PROCEDURE Method3
>      .....
>      This.Write()
>      .....
>   ENDPROC
>
>   .
>   .
>   .
>
>ENDDEFINE
>
Alexandre Palma
Senior Application Architect
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform