Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to capture Sharing Violation error
Message
 
À
15/05/1998 22:09:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00099769
Message ID:
00100013
Vues:
56
>>>Hi,
>>>
>>>I have a single user DOS application which I am now allowing to have a second user with read only rights. Some temporary tables created with sql selects (a cursor won't do since I need to chage some fields) have fixed names and sometimes lead to "sharing violation" errors in Windows 95. Since the goal is not to have to change too much of the code, I need to trap these errors, but don't know how to do it does anybody know how ?
>>>
>>>TIA,
>>>
>>>Alex
>>
>>You can do it by creating Error Procedure trapping.
>>
>>1. Issue ON ERROR DO errorproc WITH MESSAGE, ERROR() on you main program.
>>2. Your errorproc should be like this:
>>
>>Procedure errorproc
>>PARAMETERS cmessage, nerror
>>
>>* Where:
>>* nerror is error no. returned when error occurs.
>>
>>DO CASE
>>CASE nerror = some_value
>>DO ACTION HERE
>>CASE nerror = some_value
>>DO ACTION HERE
>>....
>>ENDCASE
>>
>>HTH
>
>Well Currently my Error handler is coping from VFP help:
>ON ERROR DO errhand WITH ;
> ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )
>
>
>* ErrHand.prg
>LPARAMETERS merror, mess, mess1, mprog, mlineno
> CLEAR
> =MessageBox('Error number: ' + LTRIM(STR(merror)) + chr(13) +;
> 'Error message: ' + mess + chr(13) +;
> 'Line of code with error:' + repl(chr(13),2) + [> ] + mess1 + repl(chr(13),2) +;
> 'Line number of error: ' + ALLTRIM(STR(mlineno)) + chr(13) +;
> 'Program with error: ' + mprog, 48, "Error Message Found!!")
>
>
>of cos, you can add do case to handle some special error number or
>put the code into the Error Procedure.
>
>Well, for putting object.error() I would call the fullname.prg
>
>* Done by someone here! ^_^;
>* FullName.prg 13-Jun-95
>* Generate an object's full containership name
>
>* 03-Dec-95 added additional validity testing
>* 26-Apr-96 added testing to handle _VFP object which is its own .Parent
>
>function FullName( roObject )
>*!* =NVL(.null., _screen)
>*!* messagebox(_screen.name + chr(9) + _screen.class+ chr(9) + str(_screen.formcount))
>
>if ( ( type( "roObject" ) == 'O' ) and ! isnull( m.roObject ) )
> if ( ( type( "roObject.Parent" ) == 'O' ) and ;
> ( roObject.Name != "Microsoft Visual FoxPro" ) )
> return ( FullName( roObject.Parent ) + "." + roObject.Name )
> else
> return roObject.Name
> endif
>else
> return ""
>endif
>
>
>Then, the object.error will be:
>LPARAMETERS nError, cMethod, nLine
>messagebox('Object: '+fullname(This)+chr(13)+'Method: '+cMethod+chr(13)+;
>'Error Line: '+ltrim(str(nLine)))

This applies to VFP right? His problem I think is in DOS version.
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net

CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform