Executing statements with bound parameters

Construct and execute SQL statements using bound parameters to set values for statement parameters at runtime. Bound parameters
are also used with prepared statements to provide performance benefits for statements that are executed more than once.

Prerequisites

To run the example successfully, you need the following system privileges.

For example, the following statement allocates a handle of type SQL_HANDLE_STMT with name stmt, on a connection with handle dbc:

SQLAllocHandle( SQL_HANDLE_STMT, dbc, &stmt );

Bind parameters for the statement using SQLBindParameter.

For example, the following lines declare variables to hold the values for the department ID, department name, and manager
ID, and for the statement string. They then bind parameters to the first, second, and third parameters of a statement executed
using the stmt statement handle.