开发者

Why the "Non" in "ExecuteNonQuery"?

开发者 https://www.devze.com 2022-12-30 02:10 出处:网络
I know this is not a hell of an useful question but I can\'t help being bugg开发者_Go百科ed by it.

I know this is not a hell of an useful question but I can't help being bugg开发者_Go百科ed by it.

So,

Why said method (in *Command classes) is called

ExecuteNonQuery instead of ExecuteQuery?

Aren't those SQL statements we throw at DBs, queries?


Semantically, a query is something you execute to return data. You're 'querying' the database to find all the X in the Y.

If you're not expecting back results, it's not so much a query as it is a statement or command.


Not if they are INSERTs, DELETEs, CREATE TABLEs, etc.


I would think of it as a query is asking the database for records back. Actions that alter the data/database would not be a query.

0

精彩评论

暂无评论...
验证码 换一张
取 消