This is my first SQLite + VC 2015 program, my project is in UTF-8. I have SQLite table in which I want to save Chinese. For example, I have table:
Cities { Id TEXT PRIMARY KEY, Desc TEXT }
Then, I have a dialog with a textfield, user input the City name there, and a CString variable m_szName link to it.
And, I have a piece code to insert the city into table:
stringstream sql;
sql << "INSERT OR REPLACE INTO Cities "
<< " (Id,Desc) VALUES ('1001','" << m_szName.GetBuffer() << "')";
Now the problem is, m_szName.GetBuffer() returns TCHAR*, so above program has syntax error. If I use "wstringstream sql", above code is good, but then it's not accepted by sqlite3_exec since it only accepts (char*).
I tried to convert TCHAR* to char* here and there, but nothing works. Please help, thanks.