roee oselka
roee oselka

Reputation: 21

My ExecuteNonQuery returns -1 even though 4 rows are affected

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?

Upvotes: 0

Views: 47

Answers (0)

Related Questions