Search code examples
c#stored-proceduresexecute

Get number of rows updated ObjectContext.ExecuteFunction in C#


I use ObjectContext.ExecuteFunction to execute a stored procedure which insert data to a table.

The ObjectContext.ExecuteFunction always return -1 even the records are inserted to db. Why it always returns a -1 ?


Solution

  • Check whether your stored procedure contains SET NOCOUNT ON. If so remove it.