Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 RAISERROR in Insert Command

Author  Topic 

lionee
Starting Member

2 Posts

Posted - 2007-09-07 : 15:37:45
I can not figure out whats going on
I have a stored procedure:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[spInsertSpaceItem]
(
@SpaceItemID int
)
AS

RAISERROR('ERROR' 11,1)


basically it does nothing but throw an error. I have a dataAdapter with an update and an Insert Command. Both Commands are set to the same command, and this same stored procedure. If I have an updated record in my table it throws the error, BUT if I have an added record in my table it does NOT throw an exception! Is the dataAdapter supressing it or what?

Thanks for any help on this

lionee

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-09-07 : 15:58:46
Moving this to the .NET forum since this is more of a question on the client side.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

lionee
Starting Member

2 Posts

Posted - 2007-09-07 : 16:09:55
I found it, we have a line of code in our class to not update inserted records:

private void OnRowUpdated(object sender, SqlRowUpdatedEventArgs e)
{
if ( e.StatementType == StatementType.Insert )
e.Status = UpdateStatus.SkipCurrentRow;
}

this line supressed the database exception.
Go to Top of Page
   

- Advertisement -