Binding values to a stored procedure:
This code calls a stored procedure called AsciiToInt(), passing it a character through its in parameter, and taking its result in the out parameter.
QSqlQuery query;
query.prepare("CALL AsciiToInt(?, ?)");
query.bindValue(0, "A");
query.bindValue(1, 0, QSql::Out);
query.exec();
int i = query.boundValue(1).toInt(); // i is 65
此例子中有一个地方的错误 会导致执行错误
仔细看就知道 ODBC调用Procedure的时候 应该写成 { call procedureName(par ....) }
上面的那句需要改成 { CALL AsciiToInt(?, ?) }
这样保证执行无误