ExecuteNonQuery returns -1, although execution completed successfully

I am running an asp.net 2.0 web application. Suddenly this morning, ExecuteNonQuery began to return -1, even if the SP commands executed by ExecuteNonQuery are executing (I see the elements inserted and updated in the database) and there is no exception.

This only happens when I am connected to our production database. When I am connected to our development database, they return the correct number of rows affected.

In addition, interestingly, ExecuteDataSet has no problems - it returns DataSets perfectly.

So this does not seem to be a connection problem. But then, what else could be?

+3
source share
4 answers

, , -

SET NOCOUNT ON

, ExecuteNonQuery -1.

+4

-1 " ".
SELECT -1.

SP dev .

SqlCommand:: ExecuteNonQuery Method

UPDATE, INSERT DELETE - , . , , , , , . -1. , -1.

+2

( Postgresql) NpgsqlDataAdapter, Update 1.

, db . , , , db db.

+1

ExceuteNonQuery returns -1 for all types of stored procedure according to msdn

it will return updated record values ​​only in case of sattment

0
source

Source: https://habr.com/ru/post/1707239/


All Articles