简体   繁体   中英

C++\SQL ODBC: Get row from table

I'm trying to get the rpw 'AID' from the table 'Account'.

SQLCHAR AID;
wsprintf(String, "select [AID] from [Account] where [UserID] = '%s'", User);
Sql.RetCode = Sql.Execute(String);
Sql.RetCode = Sql.Fetch();
Sql.Clear();
sprintf(String, "Here my result: %s", SQL RETURN!);
MsgBox(String);

How can i get the [AID] from the table [Account] ? (For User 'idohadar')

I see that you use some object library to call ODBC function. I do not know this library but I use ODBC from "raw" API or wrap it in my classes.

Raw API is very well described on: http://www.easysoft.com/developer/languages/c/odbc-tutorial-fetching-results.html

You must prepare buffer for values then call SQLFetch() and then read from that buffer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM