I have the following code using microsoft enterprise library 5:
Database database = DatabaseFactory.CreateDatabase("myConStr");
int rowsAffected = database.ExecuteNonQuery("[DeleteCustomer]", cboCustomers.SelectedItem.ToString());
The myConStr is correctly defined in the app.config (it works for other EL-based queries). The DeleteCustomer SP is defined as:
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
In the documentation of the ExecuteNonQuery metod the result is said to return the number of rows affected.
However, I always get the result "-1", even if the deletion works fine. What's wrong? What can I do to get the number of deleted records?
Thanks, Lucian