IRowsetChange::SetData()
-
Hello, I'm trying to write an OLE DB Wrapper class and have created a function called SetStringFieldValue and inside that function I need to set 1 columns data to the string passed to the function. I have yet to find any examples of SetData anywhere and for some reason its not working for me. Any help is greatly appreciated. [PRE] void COleDBWrapper::SetStringFieldValue(int nIndex, LPCTSTR lpszValue) { CString strValue(lpszValue); IRowsetChange* pIRowsetChange = (IRowsetChange*)m_pUnkRowsetChange; IRowsetUpdate* pIRowsetUpdate = (IRowsetUpdate*)m_pUnkRowsetUpdate; IAccessor* pIAccessor = NULL; HACCESSOR hAccessor; ULONG cBindings = 1; DBBINDING rgBinding[1]; memset(rgBinding, 0, sizeof(DBBINDING)); char szValue[50]; _tcscpy(szValue, strValue.GetBuffer(0)); rgBinding[0].iOrdinal = nIndex; rgBinding[0].dwPart = DBPART_VALUE|DBPART_STATUS|DBPART_LENGTH; rgBinding[0].obLength = (strValue.GetLength() + 1) * sizeof(TCHAR); rgBinding[0].obStatus = (strValue.GetLength() + 1) * sizeof(TCHAR); (CString)rgBinding[0].obValue = szValue; // -- DOESN'T DO JACK! -- // rgBinding[0].wType = DBTYPE_STR; rgBinding[0].pTypeInfo = NULL; rgBinding[0].pObject = NULL; rgBinding[0].pBindExt = NULL; rgBinding[0].dwMemOwner = DBMEMOWNER_CLIENTOWNED; rgBinding[0].cbMaxLen = (strValue.GetLength() + 1) * sizeof(TCHAR); rgBinding[0].dwFlags = 0; HRESULT hr = m_pUnkRowset->QueryInterface(IID_IAccessor, (void**)&pIAccessor); if (FAILED(hr)) return; hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, 1, rgBinding, 0, &hAccessor, NULL); if (FAILED(hr)) return; hr = pIRowsetChange->SetData(m_hRow, hAccessor, szValue); // hr is ALWAYS DB_E_ERRORSOCCURRED } [/PRE] Bret Faller Odyssey Computing, Inc.