【问题标题】:C++\SQL ODBC: Get row from tableC++\SQL ODBC:从表中获取行
【发布时间】:2012-04-16 18:44:26
【问题描述】:

我正在尝试从“帐户”表中获取 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')

【问题讨论】:

    标签: c++ sql-server odbc


    【解决方案1】:

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

    http://www.easysoft.com/developer/languages/c/odbc-tutorial-fetching-results.html 上对原始 API 进行了很好的描述

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

    【讨论】:

      猜你喜欢
      • 2021-06-09
      • 1970-01-01
      • 2023-03-08
      • 2017-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多