Here's the code I use in a C++ cgi module.
sprintf(buffer, "INSERT INTO `cds` (title,artist,year) VALUES('%s','%s',%d)", bTitle.c_str(), bArtist.c_str(), yr);
queryStr = buffer;
db.exe(queryStr);
At a guess, it looks like you've used mySql before in PHP from the way you expect to have the contents of the variable substituted for the variable name.
EDIT: something I whacked together in MFC:
void CmfcSqliteDlg::OnBnClickedButton1()
{
USES_CONVERSION;
CString queryStr;
CString artStr, albStr, yrStr;
artStr = _T("DeadMau5");
albStr = _T("4x4 = 12");
yrStr = _T("2010");
queryStr.Format(L"insert into cds (title, artist, year) values('%s', '%s', %s)", artStr, albStr, yrStr);
char *charStr = T2A(queryStr);
MessageBox(queryStr, _T("Query to execute"));
MessageBoxA(NULL, charStr, "Query to exeute", MB_OK);
}