Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

clarification on SQLDBC_ResultSet_bindColumn

I want help on the sequence of calls after SQLDBC_ResultSet_bindColumn to retrieve the data from the bound columns.

I am working with the HOTEL.CITY table which has 3 columns: Below is main section of my code. When I use the SQLDBC_ResultSet_getObject function inside the while loop everything works fine and i get the result of seeing all the columns on my screen. But this works even without doing the SQLDBC_ResultSet_bindColumn.

So, my question is after we do the bind, what sequence of call am i supposed to do next to achieve the same result. I assume we don't have to call "SQLDBC_ResultSet_getObject" as before.

Kindly Help......

char *stmtstr = "SELECT ZIP,NAME,STATE from HOTEL.CITY";

rc = SQLDBC_PreparedStatement_prepare(stmt, stmtstr, strlen(stmtstr),encodAsciiType );

rc = SQLDBC_PreparedStatement_executeASCII(stmt);

SQLDBC_ResultSet *result;

result = SQLDBC_PreparedStatement_getResultSet(stmt);

char szString[30];

SQLDBC_Length ind;

char szString2[40];

SQLDBC_Length ind2;

char szString3[30];

SQLDBC_Length ind3;


SQLDBC_ResultSet_bindColumn(result, 1, htype, szString, &ind, sizeof(szString), SQLDBC_TRUE);

SQLDBC_ResultSet_bindColumn(result, 2, htype, szString2, &ind2, sizeof(szString2), SQLDBC_TRUE);

SQLDBC_ResultSet_bindColumn(result, 3, htype, szString3, &ind3, sizeof(szString3), SQLDBC_TRUE);

int RowNum = 1;

while ( (rc = SQLDBC_ResultSet_next(result)) == SQLDBC_OK) {

rc = SQLDBC_ResultSet_getObject(result, 1, SQLDBC_HOSTTYPE_ASCII, szString,&ind, sizeof(szString),SQLDBC_TRUE);

printf("%s\n", szString);

rc = SQLDBC_ResultSet_getObject(result, 2, SQLDBC_HOSTTYPE_ASCII, szString2,&ind2, sizeof(szString2),SQLDBC_TRUE);

printf("%s\n", szString2);

rc = SQLDBC_ResultSet_getObject(result, 3, SQLDBC_HOSTTYPE_ASCII, szString3,&ind3, sizeof(szString3),SQLDBC_TRUE);

printf("%s\n", szString3);




Former Member

Yes, it is the rowset. The rowset is an implicit object on the result

set. You only have to go one way around and call

SQLDBC_ResultSet_getRowSet to get the (implicit) row set. The row set is tied to the result set, and unless you set the size of it or use

updatable row sets, there shouldn't be much to worry.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question