Databases Reference
In-Depth Information
rc = SQLPrepare ((SQLHSTMT)hstmt, sqlStatement, SQL_NTS);
/* Bind parameter */
rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
SQL_C_LONG, SQL_INTEGER, 10, 0,
&index, sizeof(index), NULL);
for (index = 0; index < 10; index++) {
/* Execute the UPDATE statement for each
value of index between 0 and 9 */
rc = SQLExecute (hstmt);
/* Because auto-commit is on, a commit occurs each time
through loop for a total of 10 commits */
}
/* Reset parameter bindings */
rc = SQLFreeStmt ((SQLHSTMT)hstmt, SQL_RESET_PARAMS);
/* Execute a SELECT statement. A prepare is unnecessary
because it's only executed once. */
strcpy(sqlStatement, "SELECT id, name, salary" +
"FROM employees");
rc = SQLExecDirect ((SQLHSTMT)hstmt, sqlStatement, SQL_NTS);
/* Fetch the first row */
rc = SQLFetch(hstmt);
while (rc != SQL_NO_DATA_FOUND) {
/* All rows are returned when fetch
returns SQL_NO_DATA_FOUND */
Search WWH ::




Custom Search