I've the next code using microsoft enterprise library 5:

Database database = DatabaseFactory.CreateDatabase("myConStr");
int rowsAffected = database.ExecuteNonQuery("[DeleteCustomer]", cboCustomers.SelectedItem.ToString());

The myConStr is properly defined within the application.config (it really works for other EL-based queries). The DeleteCustomer SP is understood to be:

CREATE PROCEDURE DeleteCustomer
  @CustomerID nchar(5)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    delete from dbo.Customers
    where CustomerID = @CustomerID
END

Within the documentation from the ExecuteNonQuery metod it makes sense stated to come back the amount of rows affected.

However, I usually obtain the result "-1", even when the deletion works fine. Wrong? So what can I actually do to obtain the quantity of erased records?

Thanks, Lucian

"When SET NOCOUNT is ON, the count (showing the amount of rows impacted by a Transact-SQL statement) isn't came back."