December 26, 2003 at 4:37 pm
hi,
I wrote stored procedure in sqlserver and calling in VB. but when error occured in storedprocedure it is not passing error to VB. error is occuring when inserting data into table. i tried to Raiserror statement with severity level 21. but no use.
Thanks
vishal
December 29, 2003 at 2:25 am
As an additional check from the VB side, check the errors collection of the connection object. This will return far more information regarding the error than VB's error object.
Below is a rough guide on what to use, not necessarily how to use it.
Dim cn as ADODB.Connection
Dim cm as ADODB.Command
' Code for connecting and setting the
' command object.
' Execute command
cm.Execute
' Read connection error description
cn.Errors(0).Description
Good luck.
December 29, 2003 at 3:31 am
Check your version of MDAC.
MDAC 2.6 had an error in it which stopped the error description being returned from SQL. This was fixed in MDAC 2.6 sp1.
December 29, 2003 at 6:43 am
This could be the known problem where you need to put SET NOCOUNT ON in the stored procedure.
--Jonathan
--Jonathan
December 31, 2003 at 2:27 am
try to use an output parameter (@err) that indicates if any error happened or not
ALTER Procedure AnyThing
@err int output
as
Begin transaction
set @err = 0 -- no errors
/* any insert , update or delete statement
insert into BigTable
select * from ImportTable
/* @rror is a global variable in SQL indicate if an error happened after any statment */
set @err = @err + @@ERROR
if @Err = 0
commit transaction
else
Rollback transaction
return
---------------------
I hope this help u
Alamir Mohamed
Alamir Mohamed
Alamir_mohamed@yahoo.com
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply