How to use Win32 API functions for ODBC Programming?

I'm using VC++ 5.0 to develop a application which could
access SYBASE Database through ODBC.
there is a SQL statement as the following:
SELECT name,age FROM TableName WHERE name='tony'
I call SQLExeDirect() to execute it,but now I want to
substitue the name field with a variable,such as the
following :
namestring="tony";
SQLExeDirect(...,"SELECT name,age FROM TableName WHERE name=namestring",...);
at this time ,this function cannot execute properly,it show error message
that cannot recognize 'namesring'.
I want to use variable in a SQL statement,How to
solve this problem?

aiqingAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
avivlConnect With a Mentor Commented:
Try this
namestring="tony";
QuryString ="SELECT name,age FROM TableName WHERE name="
SQLExeDirect(...,"QuryString +namestring,....);
0
All Courses

From novice to tech pro — start learning today.