Solved

Converting TCHAR

Posted on 2006-06-20
4
730 Views
Last Modified: 2013-12-14
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.
0
Comment
Question by:davyberroho
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 500 total points
ID: 16941462
you have to use strcmp
0
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 16941516
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16941547
Use _tcscmp function, this is strcmp for TCHAR type:

if(_tcscmp(dataType, _T("VARCHAR") == 0 )
{
}

0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16941554
Read more about TCHAR and Unicode here:
http://www.codeproject.com/cpp/unicode.asp
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now