How to select a value from a table and store in a variable in my sql++
e.g select name from employee;
write this query in c++ and then store the name in variable e_name
I googled and I know the mysql++ tutorials tell this code but I was connecting differently… can you see what is the problem with this.
mysql_init(&mysql);
connection = mysql_real_connect(&mysql,……….)
dheck for connection else do this
std::ostringstream query3;
query3<<"select pipe_id from pipe where version_id='"<<id<<"'";
std::storeQueryResult ares=query3.store();
for(size_t i=0;i<ares.num_rows();i++)
cout<<ares[i]["version_id"]<<ares[i]["pipe_id"]<<std::endl;
mysql_query(&mysql,query3.str().c_str());
the erroer is that store is not a member of ostringstream.
thats i understood but in above so how should i proceeed
any hints
See the mysql++ tutorial:
http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#simple
The relevant code:
In this example, the results of the query are stored in the
resvariable.