Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SP Builder Utility
Message
 
 
To
29/12/2000 15:54:38
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00457879
Message ID:
00457936
Views:
27
>>>I have just submitted to the files section my SP Builder utility. SP Builder is a straightforward, easy to use wizard that can generate several different types of stored procedures for your SQL Server database, including:
>>
>>Eric,
>>
>>I can't wait to look at it! Does it handle error trapping?
>
>Actually, I handle errors in my Data Access class, so there is no need for me to do it directly in the SP. I am open to the suggestion though, for those who wish to do it differently- do you have examples of how you handle errors in your SPs?

An example for an Update would be if it coould not find the PK specified, then no update would take place. In SQL Server not finding any rows that match the criteria of the where clause is not an error so it doesn't generate one. You could have code to check if any records were updated (maybe using the @@Rowcount variable) and if it is equal to 0, then use RAISEERROR to give some feedback to the developer/user. How does your Data Access class check now if the appropriate data change was successful?

Deletions are the same. How do you know something was actually deleted? While @@Rowcount may not be good here (unless you are deleting one item), you could attempt a select on the passed criteria. If anything is returned, then RAISEERROR.

These are just suggestions and they could be implemented outside the SP. You may do that now in your class.
Larry Miller
MCSD
LWMiller3@verizon.net

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

Click here to load this message in the networking platform