Thank you for your patience...
I try with
1 2 3
|
std::string query = "UPDATE ControlloCorrente SET ValoreAttuale = " + std::to_string(value) + " WHERE ID = '01'";
mysql_query(mysql1, query.c_str());
|
but I obtain this error
g++ -c -o RichiestaCorrente.o RichiestaCorrente.cpp
RichiestaCorrente.cpp: In function ‘int main(int, char**)’:
RichiestaCorrente.cpp:104:72: error: ‘to_string’ is not a member of ‘std’
make: *** [RichiestaCorrente.o] Error 1
I try this
1 2 3 4
|
string String = static_cast<ostringstream*>( &(ostringstream() << value) )->str();
std::string query = "UPDATE ControlloCorrente SET ValoreAttuale = " + String + " WHERE ID = \'01\'";
mysql_query(mysql1, query.c_str());
|
but I obtain this error
g++ -c -o RichiestaCorrente.o RichiestaCorrente.cpp
RichiestaCorrente.cpp: In function ‘int main(int, char**)’:
RichiestaCorrente.cpp:99:3: error: ‘string’ was not declared in this scope
RichiestaCorrente.cpp:99:3: note: suggested alternative:
/usr/include/c++/4.6/bits/stringfwd.h:65:33: note: ‘std::string’
RichiestaCorrente.cpp:99:10: error: expected ‘;’ before ‘String’
RichiestaCorrente.cpp:101:73: error: ‘String’ was not declared in this scope
make: *** [RichiestaCorrente.o] Error 1
I want to consider also your last quote:
That's kind of a lot of code for such a trivial ordeal though (C++'s string facilities suck). If you're not actually using value as an int (ie, you're not performing any arithmetic on it), then just change it to a std::string.
but how I can do to try?