Converting TCHAR

Posted on 2006-06-20
Last Modified: 2013-12-14

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?

Question by:davyberroho
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 11

Accepted Solution

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

Expert Comment

ID: 16941516
LVL 48

Expert Comment

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

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

LVL 48

Expert Comment

ID: 16941554
Read more about TCHAR and Unicode here:

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Eclipse. How to move up/down source folders 4 104
Least Squares Curve Fitting 4 117
Precision Problem in C++ 7 52
import as existing maven project 3 41
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
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.

730 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