Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual C++(VS13)与MySQL与GUI(CLR)的连接 我需要用Visual C++编写一个简单的C++应用程序,它可以连接到数据库并从中获取数据,并将其显示为文本框或标签。 我有加载的Boost和来自MySQL的C++连接器。 并将其包含到项目文件中,如下所示:_C++_Mysql_Database Connection_Visual Studio 2013 - Fatal编程技术网

Visual C++(VS13)与MySQL与GUI(CLR)的连接 我需要用Visual C++编写一个简单的C++应用程序,它可以连接到数据库并从中获取数据,并将其显示为文本框或标签。 我有加载的Boost和来自MySQL的C++连接器。 并将其包含到项目文件中,如下所示:

Visual C++(VS13)与MySQL与GUI(CLR)的连接 我需要用Visual C++编写一个简单的C++应用程序,它可以连接到数据库并从中获取数据,并将其显示为文本框或标签。 我有加载的Boost和来自MySQL的C++连接器。 并将其包含到项目文件中,如下所示:,c++,mysql,database-connection,visual-studio-2013,C++,Mysql,Database Connection,Visual Studio 2013,boost文件夹boost_1_55_0和连接器的include directory位于C/C++General中的附加依赖项中,子系统为Windows/子系统:Windows 不管我怎么尝试,它都无法建立 以下是main.cpp: #include "MyForm.h" #include <stdlib.h> #include "mysql_connection.h" #include "mysql_driver.h" #include <cppconn/driver.h

boost文件夹boost_1_55_0和连接器的include directory位于C/C++General中的附加依赖项中,子系统为Windows/子系统:Windows

不管我怎么尝试,它都无法建立

以下是main.cpp:

#include "MyForm.h"
#include <stdlib.h>

#include "mysql_connection.h"
#include "mysql_driver.h"

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

using namespace std;
using namespace sql;

using namespace System;
using namespace System::Windows::Forms;

void sqlfx() {
    Driver *driver;
    Connection *con;
    Statement *stmt;
    ResultSet *res;

    /* Create a connection */
    driver = get_driver_instance();
    con = driver->connect("localhost", "root", "");
    /* Connect to the MySQL test database */
    con->setSchema("test");

    stmt = con->createStatement();
    res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
    while (res->next()) {
        /*cout << "\t... MySQL replies: ";*/
        /* Access column data by alias or column name */
        /*cout << res->getString("_message") << endl;*/
        /*cout << "\t... MySQL says it again: ";*/
        /* Access column fata by numeric offset, 1 is the first column */
        /*cout << res->getString(1) << endl;*/
    }
    delete res;
    delete stmt;
    delete con;

}

[STAThread]
void Main(array<String^>^ args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    Project1::MyForm form;
    Application::Run(%form);
}

您是否已将boost库添加到include directories Properties->VC++目录中?@Blacktempel确实如此。。。在C/C++>General>Additional Include Directory>下,我有boost和mysql连接器。当您右键单击Include->open Document…,它是否正确地打开了文件?也检查一下。@Blacktempel不,它没有。但我不知道为什么。。。它作为boost/variant.hpp包含,并且父文件夹也包含在内,因此父boost文件夹中有一个boost文件夹,因此它应该可以正常工作…include对我来说可以正常工作,您的include设置中一定出了问题。