C++SQL ODBC:从表中获取行

C++SQL ODBC: Get row from table

本文关键字:获取 ODBC C++SQL      更新时间:2023-10-16

我正在尝试从"帐户"表中获取rpw"AID"。

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')

我看到您使用一些对象库来调用 ODBC 函数。我不知道这个库,但我使用"原始"API 中的 ODBC 或将其包装在我的类中。

原始 API 在以下方面有很好的描述: http://www.easysoft.com/developer/languages/c/odbc-tutorial-fetching-results.html

必须为值准备缓冲区,然后调用SQLFetch()然后从该缓冲区读取。