MYSQL++ problem in using Query data..

Good Am/Pm to all,

Im using MYSQL++ to extract data from my database using C++..

my problem is.. when i extract data from the database using the syntax:

double a;
mysqlpp::Query query = conn.query("select x1 from TrainingSet");
query.parse();
mysqlpp::StoreQueryResult res = query.store();
std::cout << setw(30) << res[0]["x1"] << ' ';
a=res[0]["x1"];

this code.. gets the data from the column labeled "x1" in the TABLE "TrainingSet".. then that double is then placed in res[0]["x1"].. then i transfer the data from res[0]["x1"] to "a" .. this code has no problem.. the data was successfully transfered to "a".

The PROBLEM is when the queried data is not a double.. if the data placed in the res[0]["x1"] is a string i can not transfer is to C++ data.. i tried changing the data type of "a" from char[30], char. If i do this there will be an error.

"cannot convert from 'const mysqlpp::String' to 'char'"

please help.. i cannot transfer data in other variables if the queried data is a string.

Thanks,
Robbie
Topic archived. No new replies allowed.