I need a final query like this:
const wchar_t *fin = L"UPDATE info SET status = 'closed' where age = '12'";
If the function receives a value I want to append something like this:
const wchar_t *fin = L"UPDATE info SET status = 'closed' where age = " + convertedAge;
Here is my update function code:
void updateDB(int passAge){
std::wstring myString;
convertedAge= std::to_wstring(passAge);
const wchar_t* fin = L"UPDATE info SET status = 'closed' where age = " + convertedAge;
}
How to convert that integer variable in order append that one in const wchar_t*
and act as a single query?
The C++ standard string class includes a .c_str()
function just for such situations.
void updateDB(int passAge){
std::wstring myString = L"UPDATE info SET status = 'closed' where age = '"
+ std::to_wstring(passAge) + L"'";
const wchar_t* fin = convertedAge.c_str();
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments