I am using MSVC++ Express 2.0.50727 on Win XP with an AMD Processor. Forgive me if the following is verbose, however, I am ctumped as to what little element is hindering me so i'll try to be as clear as I can.
The aim of my code is to call an SQL database (MS SQL Server 2005) using ODBC and all works well up until now.
Expand|Select|Wrap|Line Numbers
- //inside a sqlext.h file there is a typedef of UCHAR
- typedef UCHAR unsigned char
- //in my main() function
- UCHAR SQLstr[128] = "execute stored_procedure_FOOBAR 3, 'spam' "
- retcode = SQLPrepare (hStmt, SQLstr, sizeof SQLstr);
- if(retcode == something_bad){
- cout << "sqlprepare error \n";
- return 9;
- }
- retcode = SQLNumResultCols(hStmt, &cols);
- if(retcode == something_bad){
- cout<<"SQLNUmResultCols error \n";
- return 9
- }
Expand|Select|Wrap|Line Numbers
- string stringySQL = "execute stored_procedure_FOOBAR 3, 'spam' ";
- char temp[128] ;
- strcpy(temp, stringySQL.c_str());
- UCHAR SQLstr[128];
- strcpy(reinterpret_cast<char*>(SQLstr), temp);
Expand|Select|Wrap|Line Numbers
- UCHAR SQLtemp[128] ="execute stored_procedure_FOOBAR 3, 'spam' ";
- //if I now use this it works...but
- UCHAR SQLstr[128];
- for(i=0;i<128;i++){
- SQLstr[i] = SQLtemp[i]
- }
- //if I now use SQLstr it doesn't!