Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the last SQL error?
Message
 
 
À
21/09/2011 10:02:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01524131
Message ID:
01524136
Vues:
57
>>>Try
>>> lnReturn = DoSelect(lcSQL)
>>>Catch
>>> AError(laErrors)
>>>
>>> If laErrors(1) = 1832
>>> This.SetError(This.Class + ' SQL ERROR:' + laErrors(2), laErrors(1))
>>> Endif
>>>
>>> lnReturn = -1
>>>Endtry
>>>
>>
>>The only way is to fix DoSelect procedure to return information about the error.
>
>Jim Nelson gave me the answer..
>
>He said:
>
> Catch to loException
>
> loException is an exception object (look it up in help file)
>
>
>So, now my final code looks like this and works EXACTLY like needed.
>
>
>Try
>
>	lnReturn = DoDefault(lcSelect)
>
>Catch to loException
>
>	This.Seterror(This.Class + '.' +  loException.Procedure + ':' + loException.Message, loException.ErrorNo)
>
>	lnReturn = -1
>
>Endtry
>
Good point about exception - does it catch all the details?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform