Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capture SQL Passthrough error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00685447
Message ID:
00685456
Vues:
17
ON ERROR won't fire for SPT...

>If the call fails, an error is going to occur on the server, which will be surfaced to the client (fox). You could capture the error locally with an On Error routine or perhaps in an error event if this is being done in an object.
>
>The best place to trap errors is on the server. However, you can only do that if you use a stored procedure (yet another reason why stored procedures are usually a good way to go..< s >)
>
>Instead of rending the sql from the client, you make a stored procedure call like this:
>
>msql = 'insert_proc ?mfield1, ?mfield2'
>
>In the stored procedure, you can check for the value of @@error. Using an output parameter, you could return the status of whether any errors occurred.
>
>
>
>>Does anyone know how to "capture" an error generated by SQL Server from a SQL Passthrough statement?
>>
>>Example: msql='INSERT INTO table1 (field1,field2,field3) VALUES '+;
>> '(?mfield1,?mfield2)'
>>
>>obviously this INSERT statement would fail with a similar error message below:
>>
>>"There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement."
>>
>>but is there anyway to capture this error (or any error really)?
>>
>>Thanks
- Jayesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform