[unixODBC-support] SQLBindParameter problem

Nagesh Sharvari-A21337 sharvari.nagesh at motorola.com
Thu Jun 15 19:30:14 BST 2006

	I am facing a strange problem with SQLBindParameter.
I am trying to execute a simple select statement which gets a string and
a blob value from a mySQL DB.

If I use SQLBindCol the statement works fine. But if I use
SQLBindParameter, some junk value is returned for both character array
and blob value.
But I am using same SQLBindParameter function for inserting these
values. That is working fine.
Here are the Bind statements.

erg = SQLBindParameter(hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_CHAR,
15, 0, ms_min, 20, &ms_len);
erg = SQLBindParameter(hstmt, 2, SQL_PARAM_OUTPUT, SQL_C_BINARY,
SQL_LONGVARBINARY, 65000, 0, blob_Buff, 0, &blob_len);

The following SQLBindCol function works fine:

SQLBindCol(hstmt,1,SQL_C_CHAR, ms_min,20,&erg);

What's wrong with the first 2 Bind statements?

Following INPUT parameter binding is working fine:
     erg = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_CHAR, 15, 0, ms_min, 20, NULL);
     erg = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_LONGVARBINARY, bytesread, 0, blob_Buff, 0, (long*)&bytesread);

Please help me solve this

Thanks and regards

More information about the unixODBC-support mailing list