Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get VFP OLE Server to use error procedure
Message
 
 
À
06/05/1998 11:03:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00097111
Message ID:
00097354
Vues:
23
Donald,

I'm not sure if it's even safe to launch MessageBox() from the server.

The server I'm working on hse to sit there 24x7 logging realtime data so it has to do all it can survive errors. I think you'll just have to seed conditional code around the parts that can error out to skip the rest of the processing. The Error method can set a nLastError property that could be tested after each line that can give you errors and conditionally return the error to the client. I don't really know of a way to rollback the entire callstack from inside the error method. There isn't really a MASTER to return to since you are just running the method the client requested. I've got code like this in my server.

lparameters piID, piElapsedTime, piProduction, piStopCode, piLocation, piFinal

local liRetVal

update history ;
   set iElapsedTime = piElapsedTime, ;
       iProduction  = piProduction, ;
       nStopCode    = piStopCode, ;
       nLocation    = piLocation, ;
       lUpdated     = .t., ;
       lFinal       = ( piFinal != 0 ) ;
    where iID = piID

liRetVal = iif ( _tally = 1, ERROR_SUCCESS, ERROR_FAILED_HISTORY_UPDATE )

if ( liRetVal != ERROR_SUCCESS )
   this.BackColor = rgb(255,0,0)
   this.Log( "Failed history update:" + str( piID ) )
endif

return ( liRetVal )


>Everyone keeps saying that an OLE Server cannot do screen I/O but I've got messageboxes every where including the Error method. And I too log the errors to a file. I know that the client has to manipulate the server and basically is it's owner. The problem is not actually shutting down so much as cease processing. I instantiate the server at client load and it just sits in process. The client can call any number of methods from the server at any given time. But let's say the client calls a method, and there is an error because one of the tables it needs to wite to is being use exclusively; I want the Error method to be called and the server to stop processing the rest of the calling method code and return to the client a -1. What happens is the Error method is called, the messagebox pops up, the message gets logged, and then...the rest of the code, right after the code that caused the error, proceeds. Even if I call the server's Release method it still returns to finish where
>it left off. MS suggested I use CANCEL in the Error method. I tried that and it kinda works, I can't get the proper return value back to the client. Is there no way to accomplish this?
>
>Oh BTW, thanks for responding.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform