Home > database >  Mysql using problem - of all stripes help Daniel!!!!!
Mysql using problem - of all stripes help Daniel!!!!!

Time:09-28

Question is like this, be free and at leisure to practice under mysql++ using examples, the result is always puzzling of mistakes,,,,
Purposely done to the code to simplify, post, to help each Daniel
 # include & lt; Iostream> 
# include & lt; Mysql++. H>
Using namespace STD.

Int main ()
{
Const char * db="aries_role", *="127.0.0.1" server, * user="root", * pass="123456";

Mysqlpp: : Connection conn (false);

//connect to the database
If (conn. Connect (db server, the user, pass))
{
//from the role of role table lookup with ID 99
Mysqlpp: : Query Query=conn. Query (" select * from role where id=99 ");
Mysqlpp: : StoreQueryResult resu=query. The store ();
Int nRows=resu. Num_rows ();
If (nRows & gt; 0)
{
Cout
Cout}
The else
{
std::cout <"Failed to get the item list:" & lt; }
}

return 0;
}
code is very simple, is to connect to the database after aries_role, then from the role of role table lookup with ID 99
But the result run to the last time is always complains!!!!!!!!!!


Mean variable resu cause stack overflow??????

I had print:
Cout
Cout 20428360 , this is what the devil, there are so many data??????? May be this cause the stack overflow above

What went wrong, consult everybody database, niche thanked the first

CodePudding user response:

By himself first, cool people to see, that is a question which I met yao only

CodePudding user response:

Problem has been solved, because the Debug version of the program with the Release version of the library files...
  • Related