davyberroho
asked on
Converting TCHAR
Hi,
I would like to do following thing:
TCHAR dataType[128];
SDWORD cbdatatype;
SQLGetData(hstmt, 1, SQL_C_CHAR, dataType, sizeof(dataType), &cbdatatype);
if(dataType == "VARCHAR")
{
...
}
the problem is that I cannot compare "VARCHAR" with an array of tchars.
Does someone has a solution?
thx.
I would like to do following thing:
TCHAR dataType[128];
SDWORD cbdatatype;
SQLGetData(hstmt, 1, SQL_C_CHAR, dataType, sizeof(dataType), &cbdatatype);
if(dataType == "VARCHAR")
{
...
}
the problem is that I cannot compare "VARCHAR" with an array of tchars.
Does someone has a solution?
thx.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_rfx_text.asp
Use _tcscmp function, this is strcmp for TCHAR type:
if(_tcscmp(dataType, _T("VARCHAR") == 0 )
{
}
if(_tcscmp(dataType, _T("VARCHAR") == 0 )
{
}
Read more about TCHAR and Unicode here:
http://www.codeproject.com/cpp/unicode.asp
http://www.codeproject.com/cpp/unicode.asp