SQLCommand.Prepare

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

under what circumstances would one want to make a call to
SQLCommand.Prepare() ?

what exactly does it accomplish ?
 
under what circumstances would one want to make a call to
SQLCommand.Prepare() ?

what exactly does it accomplish ?

As I understand it, preparing a statement basically does a lot of the
parsing, validation etc (either on the client side or on the server
side, depending on the database and driver) so that the statement can
be executed several times with different parameters efficiently.
Typical use case (again, as I understand it):

Create the command
Add parameters (the placeholders)
Prepare the command

In a loop:
Set parameter values
Execute command
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top