hello,
i getthis error Multiple-step OLE DB operation generated errors when i use distinct or group by in my query.
i dont know how to risolve.
i tride to chenge connection string but nothing
here is my code ( i am using VS 2019 - mfc c++)
LPCOLESTR hh;
hh = L"yy";
BSTR bstr = NULL;
CString str, strDBcorr,strDBcorr1;
LPCOLESTR strDBCor;
HRESULT hrCorr, hr;
bstr = strDBcorr.AllocSysString();
strDBCor = bstr;
strDBCor = _T("Provider=MSOLEDBSQL; Data Source=aaa\\SQLEXPRESS;Initial Catalog=Tag21;User ID=sa;Password=xx;");
hrCorr = dsdbCorr.OpenFromInitializationString(strDBCor);
SysFreeString(bstr);
if (SUCCEEDED(hrCorr))
{
TRY
{
hr = m_sisDBTag.Open(dsdbCorr);
}
CATCH(CException, e)
{
}
END_CATCH
String SqlProv;
SqlProv = _T("SELECT DISTINCT Field_1 FROM Table_1;");
TRY
{
CDBPropSet propset2(DBPROPSET_ROWSET);
propset2.AddProperty(DBPROP_IRowsetChange, true)
propset2.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_INSERT | DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE)
CCommand<CManualAccessor,CRowset> rsss;
if (rsss.Open(m_sisDBTag, SqlProv, &propset2, NULL, DBGUID_DBSQL, TRUE) != S_OK)
{
here i get the error
...
thanks in advance
What I have tried:
in sql server i dont have problems to excute the query