The most efficient way for doing so would be using
SQLite3[
^].
This is an open source project. The Windows version doesn't require any additional framework and you can use it with plain Win32 API.
SQLite3 lacks proper support for UNICODE, so I usually use a wrapper called
CppSqlite3[
^] which is also very simple and straight forward.
Here is an example I wrote:
bool UpdateRecord(bool UpdateOnly, CString FieldName,CString FieldValue)
{
CppSQLite3DB temp;
temp.open(DBName);
CString sql;
if (UpdateOnly)
{
sql = (CString)L"UPDATE log " + (CString)L" SET " + FieldName + L" = " + FieldValue;
}
else
{
sql = L"REPLACE INTO log (" + FieldName + L") VALUES ('" + FieldValue + L"')";
}
CppSQLite3Query SqlQuery;
try
{
SqlQuery = temp.execQuery(sql);
}
catch (CppSQLite3Exception & e)
{
temp.close();
return false;
}
temp.close();
return true;
}