mysql - 将 MVC++ 与 SQLAPI++ 连接起来

标签 mysql visual-c++

我使用的是 Microsoft Visual c++ 2008 Express Edition。

我关注了 SQL API 网站 [http://www.sqlapi.com/index.html]。

我已经安装了 SqlApi++,但是我的编译器没有检测到 #include <SQLAPI.h>

我做错了什么?

这是我的代码:

#include <stdio.h>  // for printf
#include <SQLAPI.h> // main SQLAPI++ header

int main(int argc, char* argv[])
{
    SAConnection con; // create connection object

    try
    {
        // connect to database
        // in this example it is Oracle,
        // but can also be Sybase, Informix, DB2
        // SQLServer, InterBase, SQLBase and ODBC
        con.Connect(
            "test",     // database name
            "tester",   // user name
            "tester",   // password
            SA_Oracle_Client);

        printf("We are connected!\n");

        // Disconnect is optional
        // autodisconnect will ocur in destructor if needed
        con.Disconnect();

        printf("We are disconnected!\n");
    }
    catch(SAException &x)
    {
        // SAConnection::Rollback()
        // can also throw an exception
        // (if a network error for example),
        // we will be ready
        try
        {
            // on error rollback changes
            con.Rollback();
        }
        catch(SAException &)
        {
        }
        // print error message
        printf("%s\n", (const char*)x.ErrText());
    }

    return 0;
}

最佳答案

请检查您是否将带有 SQLAPI 头文件的包含目录添加到项目的附加包含目录列表中(打开项目的属性页,选择选项卡 C++\General,chnage 属性“附加包含目录”以添加 包含 SQLAPI++ 分发的子目录。

可能,您必须对 SQLAPI 库执行相同的操作(将 lib 文件夹的路径添加到“Linker/General”选项卡的属性“Additional library directories”中)

关于mysql - 将 MVC++ 与 SQLAPI++ 连接起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8655466/

相关文章:

c++ - fatal error C1083 : Cannot open include file: 'Item.h” ': No such file or directory

c++ - 不断增加物理内存 Visual C++ CryptMsgClose 和 CryptReleaseContext

c++ - C++ 中的值访问

MYSQL - Group BY 与 MAX 问题

php - 在 codeigniter 的单个缓存文件夹中管理两个不同的缓存文件

php - 使用查询绑定(bind) Fuelphp

c++ - 无法创建 SymmetricKey

mysql - PHP MySQL 如果其他列的值等于苹果,如何使 mysql 求和列

html - 使用 mysql 查询生成大型 html 表非常慢 - 4000+ 行查询

c++ - "1.$"是什么意思?