Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return warnings from SQL server
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00449899
Message ID:
00450359
Views:
27
>Try aerror() function just after executing any command for SQL Server from VFP. Probably (I'm not sure) you will get all warning messages there, even when no error generated by VFP.
>
>>I have a few (SQL server) stored procedures that are triggering some system warnings as well as some of my own warnings (serverity 10). I'd like to return those warnings to the client (VFP through ODBC). There is the "Dispwarning" setting that I set to TRUE, but it looks like the SQL will report the warnings only if at lest one error (severity 16 ot higher) occurred.
>>
>>Is there any way I can return the all warnings even if no error occured?
>>
>>Thank you.

Vlad,
No you won't. Unless SQL Server returns a severity code of 16 or greater, SQLEXEC does not return a -1 and AERROR() doesn't pick anything up.

Sorin,
Maybe a better approach would be to insert rows into a warning table for this stuff. Once the process returned , you could query on that table to find any new warnings and display them to your users. You could pass in an ID to use to track warnings associated with the just completed process.

Or you could always change the severity of your warnings to make them errors. SQL will continue to process your trigger even though an "error" took place. You would just have to set and check some flag to determine success (or that could be one of the "errors" you raise.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform