hi,
I have trouble with getting info from my table, this is my code:
#include "stdafx.h"
#include <iostream>
#include <mysql++.h>
#include <manip.h>
using namespace std;
#define HOST ""
#define USER "senergy"
#define PASSWORD ""
#define DATABASE ""
#define PORT 3306
// deleted info :)
int main(int argc, char *argv[])
{
try
{
mysqlpp::Connection connection(DATABASE, HOST, USER, PASSWORD, PORT);
mysqlpp::Query query = connection.query("SELECT * FROM accounts");
mysqlpp::StoreQueryResult result = query.store();
cout << result[0]["login"];
}
catch(mysqlpp::Exception e){
cerr << "problem: " << e.what() << endl;
return -1;
}
cin.get();
return 0;
}
well, after executing, I'll get this error:
http://filebeam.com/e5275cc9d8a9738d7f6e672692cca1ae.jpg
and if I use
"SELECT login FROM accounts"
and
cout << result[0]
I'll get 1 as output, not my login username, without any error
with this:
cout << "Number of records: " << result.size() << '\n';
for(size_t i = 0; i < result.size(); ++i)
cout << result[i]["id"] << '\n';
I'm getting 0 records, so there is something wrong with it, i'm using same mysql details as I'm using in createaccount and it's working well, I've used
"SELECT acct FROM accounts WHERE login = 'senergy'"
too but it's causing another debug error (this works in navicat console well)