June 12, 2008 at 7:26 am
I am a VB6 developer who uses database techniques as part of my software development skills. Since I started dabbling in SQL Server 2000, I like it more with every passing week as I continue to learn new techniques which let me move a lot of my code out of VB to SQL. The end result is it makes my projects much better and elegant too. And this site has really helped me gain in skills. Thank you all.
I would like to acquire one must-have skill yet: I would like to build error handling in my sprocs, but since my users will be using SQL Server indirectly (via my app), I want to be able to intercept those TSQL error messages with VB6.
I shall be glad to receive any help.
June 14, 2008 at 12:30 pm
Error handling in sql 2000 is a tricky process.
You have to evaluate after each statement. Some errors immediately abort the batch.
statement
/*saving the error*/
@myvar=@@error
if @myvar<>0
BEGIN
doerrorhandling
END
statement
@myvar=@@error
if @myvar<>0
BEGIN
doerrorhandling
END
Inside the stored procedures you will only have the error number.
The errors (number, description,...) come back in the errors collection.
You may raise an error with RAISERROR
June 16, 2008 at 2:34 am
June 17, 2008 at 6:11 am
June 17, 2008 at 11:50 am
My apology for the pause.
Have a look at the end of
http://www.macronimous.com/resources/stored_procedures_for_ASP_and_VB_Programmers.asp
or
http://msdn.microsoft.com/en-us/magazine/cc163987.aspx
A more elaborate version inside the stored procedure:
http://www.novicksoftware.com/coding-in-sql/Vol3/cis-v3-N12-making-stored-procedures-readable.htm
June 18, 2008 at 12:48 am
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply