Reputation: 179
I have created a VC6.0 MFC app. I also set the project in unicode mode.
But I when I load the unicode data (e.g. Russian) from sql db, I also get question mark string "????..."
_variant_t TheValue;
CString str;
try
{
m_list.ResetContent();
//m_pConnection.CreateInstance(_uuidof(Connection));
m_pRecordset.CreateInstance(_uuidof(Recordset));
m_pRecordset->Open("SELECT * FROM MyUser",(IDispatch*)m_pConnection, adOpenDynamic, adLockOptimistic,adCmdText);
while(!m_pRecordset->adoEOF)
{
TheValue = m_pRecordset->GetCollect("name");
if(TheValue.vt!=VT_NULL)
{
str=(LPCSTR)_bstr_t(TheValue);
m_list.AddString(str);
}
m_pRecordset->MoveNext();
}
m_pRecordset->Close();
}
catch(_com_error e)
{
CString errormessage;
errormessage.Format(L"Connect failedr\n error:%s", e.ErrorMessage());
AfxMessageBox(errormessage);
}
Upvotes: 2
Views: 176