O'Reilly logo

Essential ADO.NET by Bob Beauchemin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.7. Command Preparation, Cancellation, Timeouts, and Cleanup

The IDbCommand interface has a method called Prepare, which makes a round-trip to the database to tell the database to Prepare the statement and cache it in its query cache for later use. Because all modern databases cache query plans without asking, the only thing Prepare buys you with most databases is a little faster execution speed the first time the query is executed; you also get some control over the lifetime of the query plan. This comes at the expense of a database round-trip, so its usefulness is questionable—although, on a busy system, a statement that isn't prepared could have its query plan flushed, depending on the query cache management policy of the database. Although ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required