|
-
Nov 1st, 2000, 05:56 AM
#1
Thread Starter
Addicted Member
Hi all,
Just a question on Stored Procedures. I am new to VB and to SQL, I have to add some error handling to some stored procedures. They are all Select procedures that are passed varibles from VB. They do not return anything.
I just want to learn how report any errors (if any) to the vb app and display them to the user.
Is there any one out there that can help????
Thanks in advance
Rocks,
-
Nov 1st, 2000, 06:39 AM
#2
Hyperactive Member
Can you expand on this..? what error handeling are you coding into your stored procedure?
-
Nov 1st, 2000, 06:52 AM
#3
Thread Starter
Addicted Member
Stored Procedures
Hi,
What I would like to do is to check if the statement has been processed, and where statements use Varibles, I would like to check if they have been passed, are not null.
If you like I can mail you a stored procedure that I am working on.....
Regards,
Rocks
-
Nov 1st, 2000, 07:57 AM
#4
Hyperactive Member
I use a stored procedure, and check the results are not null by using this statement below, using a UserConnection
Code:
Dim rd as rdoresult
If IsNull(rd!fieldname)Then
blah de blah
End if
The ISNull check the returned data is not NULL.
Craig.
-
Nov 1st, 2000, 09:57 AM
#5
Fanatic Member
Many ways..
In the stored proc
(after the select)
IF @@ERROR <> 0
goto MyError
return (0) -- Success
MyError:
return(1) -- Failure
or any error value you want
Now in your VB
you can check for these values
That's just one way...
-
Nov 1st, 2000, 10:11 AM
#6
Thread Starter
Addicted Member
Store Proc
lafor.
I managed to get that far what I would like to lnow is how to Pull the error info out of the store proc into VB...
any advice???
Cheers mate
-
Nov 1st, 2000, 10:17 AM
#7
Fanatic Member
....
When an error occurs the global var
Err is automatically populated with the necessary info
including err number and description
if in your VB, you have
OnError goto CHrisjk (at the top of your proc)
then
Chrisjk:
MsgBox "Sorry! Error '" & Err.Description '& " 'While Executing this stored proc name here "
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|