Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Help Please!!! - SQLBindParameter
#define SMALL_LEN 50
SQLCHAR *helpCType[SMALL_LEN]; string cType[] = {"SQL_C_CHAR","SQL_C_CHAR","SQL_C_CHAR","SQL_C_CHAR"}; string sqlType[] = {"SQL_CHAR","SQL_CHAR","SQL_CHAR","SQL_CHAR"};
rc = SQLNumParams(hstmt,&numCols);
if(rc == SQL_SUCCESS){
for(int i = 0; i < numCols; i++){
//rc = SQLBindParameter(hstmt, (SQLSMALLINT)i+1,
//SQL_PARAM_OUTPUT, SQL_C_CHAR,(SQLSMALLINT)sqlType[i].c_str(),
//len, 0,(void *)name[i].c_str(),0,&DataLen[i]);
lstrcpy((char *)helpCType, cType[i].c_str());
rc = SQLBindParameter(hstmt, (SQLSMALLINT)i+1,SQL_PARAM_OUTPUT,
(SQLSMALLINT)helpCType,(SQLSMALLINT)sqlType[i].c_str(),len,0,
(void *)name[i].c_str(),0,&DataLen[i]);
}
}
The commented statement works fine, and the uncommented does not work -
paramtertype out of range...
The difference b/w the two is the ValueType (fCType) - one entered as
it is (SQL_C_CHAR) and the other as a variable helpCType(it fails to
accept this, though it gets the right value)
I do use odbc from oracle9i (vers:9.00.11.00).
Please could anyone try it and give me feedbacks.
How can I improve it?
Regards,
Harp
Received on Tue Feb 22 2005 - 05:05:05 CST