Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL Connector/C++ Example code is not working
    primarykey
    data
    text
    <p>Hello i've just started using C++ MySql Connector in appication Release|Win3 </p> <p>My Errors:</p> <blockquote> <p>Warning 1 warning C4627: '#include ': skipped when looking for precompiled header use c:\Documents and Settings...</p> <p>Warning 2 warning C4627: '#include ': skipped when looking for precompiled header use c:\Documents and Settings...</p> <p>Error 3 fatal error C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory C:\Program Files\MySQL\MySQL Connector C++ 1.1.0\include\cppconn\connection.h 29 lacznik</p> </blockquote> <pre><code>#include &lt;cstdlib&gt; #include &lt;iostream&gt; #include "stdafx.h" #include "mysql_connection.h" #include &lt;cppconn/driver.h&gt; #include &lt;cppconn/exception.h&gt; #include &lt;cppconn/resultset.h&gt; #include &lt;cppconn/statement.h&gt; using namespace std; int main(void) { cout &lt;&lt; endl; cout &lt;&lt; "Running 'SELECT 'Hello World!' » AS _message'..." &lt;&lt; endl; try { sql::Driver *driver; sql::Connection *con; sql::Statement *stmt; sql::ResultSet *res; /* Create a connection */ driver = get_driver_instance(); con = driver-&gt;connect("tcp://127.0.0.1:3306", "root", "root"); /* Connect to the MySQL test database */ con-&gt;setSchema("test"); stmt = con-&gt;createStatement(); res = stmt-&gt;executeQuery("SELECT 'Hello World!' AS _message"); while (res-&gt;next()) { cout &lt;&lt; "\t... MySQL replies: "; /* Access column data by alias or column name */ cout &lt;&lt; res-&gt;getString("_message") &lt;&lt; endl; cout &lt;&lt; "\t... MySQL says it again: "; /* Access column fata by numeric offset, 1 is the first column */ cout &lt;&lt; res-&gt;getString(1) &lt;&lt; endl; } delete res; delete stmt; delete con; } catch (sql::SQLException &amp;e) { cout &lt;&lt; "# ERR: SQLException in " &lt;&lt; __FILE__; cout &lt;&lt; "(" &lt;&lt; __FUNCTION__ &lt;&lt; ") on line " » &lt;&lt; __LINE__ &lt;&lt; endl; cout &lt;&lt; "# ERR: " &lt;&lt; e.what(); cout &lt;&lt; " (MySQL error code: " &lt;&lt; e.getErrorCode(); cout &lt;&lt; ", SQLState: " &lt;&lt; e.getSQLState() &lt;&lt; " )" &lt;&lt; endl; } cout &lt;&lt; endl; return EXIT_SUCCESS; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload