November 11, 2002 at 5:46 am
I am running a stored procedure from VB. The code looks like this:
CREATE PROCEDURE [CPL_sp_get_RootOfTitle_TitleNos]
@Matter_ID VARCHAR(12),
@OutErrCode INT Output
AS
BEGIN
DECLARE @Reg_type varchar(10)
SET @OutErrCode = 0
SET @Reg_type = ''
-- set variables to represent clause members ID's defined for Incumbrances
-- determine registration type for matter
select @Reg_type = registration_status_id
from part_property pp,
matter m
where m.primarykey = @Matter_ID
AND m.property_id = pp.property_id
-- obtain the error code
SET @OutErrCode = @@ERROR
--if no errors then continue
IF @OutErrCode=0
BEGIN
-- check that the registration type is a recognised type, throw an error in the case where it is not
IF @Reg_type not in ('CPL_Regist', 'CPL_Unreg', 'CPL_Both') OR @Reg_type is null
BEGIN
RAISERROR (340160, 11, 1, @Matter_ID, 'CPL_sp_get_RootOfTitle_TitleNos : 10 - Unrecognised or NULL registration type for property')
SET @OutErrCode = @@ERROR
END
END
-- if no errors upto this point, use the registration type to determine the clause text to be returned
IF @OutErrCode=0
BEGIN
IF @Reg_type IN ('CPL_Regist', 'CPL_Both')
BEGIN
SELECT TITLE_NUMBER
FROM PART_PROPERTY PP,
MATTER M
WHERE M.PRIMARYKEY = @Matter_ID
AND M.PROPERTY_ID = PP.PROPERTY_ID
END
-- check for errors occuring during select
-- obtain the error code
SET @OutErrCode = @@ERROR
END
RETURN(@OutErrCode)
END
GO
Problem I am encountering is at the Set Rs = .Execute line where a run-time error occurs and a dialog pops up (in other words VB hangs). The application will not allow any debugging.
Any ideas as to why this happens?
Regards
Tayo
November 11, 2002 at 4:01 pm
Errors are handled direct by VB, when the error message is sent. You cannot raise and error like you have you need to not use RAISERROR, of if so handle the error correctly in your VB
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 11, 2002 at 4:12 pm
First how are you running the app? What options does it give you when the error window pops up? Also, if you know the line will fail then trap it and put a breakpoint in your trap to see if it still hangs? VB does hang occasionally but has nothing to do with the use of RASIERROR, sometimes it is not really hung just slow to fully respond.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply