valid errors cause vb to stop running 
Author Message
 valid errors cause vb to stop running

I have a VB program that calls a stored procedure.

Within this stored procedure, a cursor is created and I loop through
the cursor inserting records into a table.  I have error handling code
in place as well.

Let's say that I get an error like 'attempt to insert duplicate
record'.

If you run this SP in enterprise manager, the error shows up and I
rollback the transaction for that one account and fetch the next one.
The way it should be.  Output would be something like:

Error- 234234 attempt to insert duplicate blah blah blah
Account 213123123 was rolled back.
Error- 234234 attempt to insert duplicate blah blah blah
Account 122111222 was rolled back.
SP inserted 12433 records into Activity Table.
End.

When calling this SP from VB, the first error VB sees, it halts the SP
execution and I get the insert duplicate error returned to the program.

Do you know of any way to hide these error messages?  Or trick VB into
not seeing them?

Sent via Deja.com http://www.***.com/
Share what you know. Learn what you don't.



Fri, 14 Dec 2001 03:00:00 GMT
 valid errors cause vb to stop running

I have a VB program that calls a stored procedure.

Within this stored procedure, a cursor is created and I loop through
the cursor inserting records into a table.  I have error handling code
in place as well.

Let's say that I get an error like 'attempt to insert duplicate
record'.

If you run this SP in enterprise manager, the error shows up and I
rollback the transaction for that one account and fetch the next one.
The way it should be.  Output would be something like:

Error- 234234 attempt to insert duplicate blah blah blah
Account 213123123 was rolled back.
Error- 234234 attempt to insert duplicate blah blah blah
Account 122111222 was rolled back.
SP inserted 12433 records into Activity Table.
End.

When calling this SP from VB, the first error VB sees, it halts the SP
execution and I get the insert duplicate error returned to the program.

Do you know of any way to hide these error messages?  Or trick VB into
not seeing them?

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Fri, 14 Dec 2001 03:00:00 GMT
 valid errors cause vb to stop running
In your VB code, try "ON ERROR RESUME NEXT" or "ON ERROR GOTO line".  Those
statements will keep the program from blowing up, but it will be up to you
to decide how the code should recover.  Note that VBscript, if you ever use
it, lacks the "ON ERROR GOTO line" syntax.

Geoff.


Quote:
>I have a VB program that calls a stored procedure.

>Within this stored procedure, a cursor is created and I loop through
>the cursor inserting records into a table.  I have error handling code
>in place as well.

>Let's say that I get an error like 'attempt to insert duplicate
>record'.

>If you run this SP in enterprise manager, the error shows up and I
>rollback the transaction for that one account and fetch the next one.
>The way it should be.  Output would be something like:

>Error- 234234 attempt to insert duplicate blah blah blah
>Account 213123123 was rolled back.
>Error- 234234 attempt to insert duplicate blah blah blah
>Account 122111222 was rolled back.
>SP inserted 12433 records into Activity Table.
>End.

>When calling this SP from VB, the first error VB sees, it halts the SP
>execution and I get the insert duplicate error returned to the program.

>Do you know of any way to hide these error messages?  Or trick VB into
>not seeing them?

>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.



Fri, 14 Dec 2001 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Bug in Fulltext Service for a long valid string causing service to stop

2. Error 1203 causes SQL 7 service to stop...help needed

3. vb run time error : 0 description run

4. Need a utility will stop running SQL batch at first error

5. Stopping SQL script run on error

6. causes error and its not even run, eh?

7. Scripting.Dictionary causes error when running package outside of designer

8. DTS Running DTSRUN Using the NT Scheduler causes Error

9. loading more than 1 crystal report cause a run time error

10. Debug gets results, but run causes error

11. Filter of ADO Recordset causing run-time error 3265

12. Running FixPack caused error


 
Powered by phpBB® Forum Software