September 28, 2011 at 1:48 pm
I am changing a VARCHAR(150) field to a TEXT field because we now do not want a limit on what we put in it. Performance hits aside, how in C++ what SQL_TYPE and length values do I need to put into what once was:
SQLBindCol(hstmt, 1, SQL_C_CHAR, theField, 150, &cbTheField);
September 29, 2011 at 2:22 pm
I've found the answer. I couldn't bind to a TEXT field. Instead I needed to repeatedly call SQLGetData():
retcode = SQLPrepare(hstmt, L"SELECT theField FROM theTable WHERE thatOtherField= ?", SQL_NTS);
SQLINTEGER cbthatOtherFieldValue = 0;
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_GUID, SQL_GUID, 0, 0, &thatOtherFieldValue, 0, &cbthatOtherFieldValue);
retcode = SQLExecute(hstmt);
if (retcode == SQL_SUCCESS)
{
char final[8000];
SQLINTEGER pIndicator;
SQLFetch(hstmt);
while(SQLGetData(hstmt,1,SQL_C_CHAR,final, sizeof(final),&pIndicator)==SQL_SUCCESS_WITH_INFO)
{
strcat(valueBack,final);
}
result = true;
}
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy