title: VS Express 2013 C++ with MySQL Connector stmt->executeQuery() error
body: <p>So I finally got VS 2013  C++ to connect with mySQL using the Connector C and C++ and I know this because I am able to add a table into my DB using the stmt->execute() function.</p>
  
  <p>Now, I am trying to get the rows using the ResultSet to retrieve from function executeQuery, but this error shows up:<br/>
  <img src="https://i.stack.imgur.com/BGmv9.jpg" alt="enter image description here"><br/>
  Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  #include "mysql_connection.h"
  #include "mysql_driver.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;
  #include &lt;cppconn/prepared_statement.h&gt;
  
  #define dbHOST "tcp://127.0.0.1:3306"
  #define dbUSER "root"
  #define dbPASS "root"
  #define dbDB   "db_test"
  
  using namespace std;
  using namespace sql;
  
  int main()
  {
      sql::mysql::MySQL_Driver *driver;
      sql::Connection *con;
      sql::Statement *stmt;
      sql::ResultSet *res;
  
      driver = sql::mysql::get_driver_instance();
      con = driver-&gt;connect(dbHOST, dbUSER, dbPASS);
  
      stmt = con-&gt;createStatement();
      string query = "SELECT * FROM test";
      res = stmt-&gt;executeQuery(query.c_str());
  
      while (res-&gt;next()) {
          cout &lt;&lt; "id = " &lt;&lt; res-&gt;getInt(1); 
          cout &lt;&lt; ", label = '" &lt;&lt; res-&gt;getString("label") &lt;&lt; "'" &lt;&lt; endl;
      }
  
      delete res;
      delete stmt;
      delete con;
  
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>Under the output pane, it shows this as well:<br/></p>
  
  <pre><code>First-chance exception at 0x77661D4D in MySQLConnect.exe: Microsoft C++ exception: sql::SQLException at memory location 0x0088FB5C.
  
  Unhandled exception at 0x77661D4D in MySQLConnect.exe: Microsoft C++ exception: sql::SQLException at memory location 0x0088FB5C.
  </code></pre>
  
  <p>Under the call stack after I hit F5 and it breaks, it shows this:</p>
  
  <blockquote>
    <p>MySQLConnect.exe!main() Line 35 C++</p>
  </blockquote>
  
  <p>Line 35 is the line with <strong>res = stmt->executeQuery(query.c_str());</strong></p>
  
  <p>Let me know if you need more information on my code / settings.
  Thanks in advance!</p>