Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. IRowsetChange::SetData()

IRowsetChange::SetData()

Scheduled Pinned Locked Moved Database
databasecomhelp
1 Posts 1 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bret Faller
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups