开发者

Performance difference - Multiple queries put together in one sql command object and one sql command object per query

开发者 https://www.devze.com 2023-02-22 02:19 出处:网络
Is there any per开发者_如何学运维formance difference when multiple queries are put together in an string object and and passed for sql command and running it only once

Is there any per开发者_如何学运维formance difference when multiple queries are put together in an string object and and passed for sql command and running it only once

and

One sql command object is created per query and each is run one by one.

Thanks, David


What you are describing is a batch. They are faster than running two ado.net commands with one statement each. It would probably be even faster to use a stored procedure, which has better support in ADO.NET. (ADO.NET treats a batch as just a bunch of SQL-- no special features.) Some datasources (like MS-Access) don't understand batches or stored procedures for that matter.

0

精彩评论

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

关注公众号