Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RAISERROR ASP

Status
Not open for further replies.

bruslx

IS-IT--Management
Jun 29, 2001
16
0
0
BE
Hi,
I wrote a trigger on SQL 2000 that fires a specific error message if validation fails .
Works fine within the SQL Server Enterprise , but from an ASP page I get '[Microsoft][ODBC SQL Server Driver][SQL Server]' , nothing else .
I would like to get my complete error message (entered via RAISERROR) on my ASP page.

Any idea ?

Thanks

SLX
 
What code are you using that fires a specific error message?
Thanks,

Gabe
 
Thanks Gabe

When I submit the ASP form with a blank pro_name field , I only an unsignificant error
here is the trigger :

CREATE TRIGGER PRO_NAME ON dbo.XX_PROJECT
FOR INSERT, UPDATE
AS
declare @CalculatedProjectName as char(60) ,
@pro_id as int

select @pro_id = (SELECT pro_id FROM inserted)
select @CalculatedProjectName = (SELECT pro_name FROM inserted)
set @CalculatedProjectName = rtrim(@CalculatedProjectName)

print @CalculatedProjectName

IF len(@CalculatedProjectName) = 0
BEGIN
RAISERROR (' ===>> Empty project name <<===
',16,1,@CalculatedProjectName)
ROLLBACK TRANSACTION
END


UPDATE XP_PROJECT
SET pro_name = @CalculatedProjectName where pro_id = @pro_id

****************************************************

SLX
 
I did a search on Google for RAISERROR sql server ado.

Here is one article from Microsoft.

Also, since you are throwing an error would turning on error handling before the ADO call help?
Code:
on error resume next

Then after the ADO call you check the ado errors and vb errors to see if anything went wrong.

Thanks,

Gabe
 
Gabe , here is the ASP code.
on error resume next is already in.
Will have a look on the MS doc.

Thanks
SLX
**************************************************
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.commandText = &quot;SET NOCOUNT ON;&quot; & MM_editQuery & &quot;;SELECT @&quot; & &quot;@IDENTITY AS Ident&quot;

on error resume next
MM_editCmd.Execute

MM_editCmd.ActiveConnection.Close

if err.number then
fault = &quot;&quot;
OriginalError = err.description
'response.write originalerror
MyPos = Instr(1, err.description,&quot;INSERT statement conflicted with TABLE CHECK constraint 'XX_DEMOTRANSAC_CONSTRAINT_DATES'&quot;)
If MyPos > 0 then
fault = &quot;Stop Date is Previous to Start Date !&quot;
End if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top