My ExecuteNonQuery returns -1 even though 4 rows are affected

48 Views Asked by At

When I run the query against the database, I get (4 row(s) affected).

When I run it through C#, I get -1 as the return value.

This is my code:

cmd.CommandText = "SELECT name FROM stock";

int x = cmd.ExecuteNonQuery();

Why do I get -1?

0

There are 0 best solutions below