Article ID: 201390
Article Last Modified on 1/9/2006
ATLASSERT(m_pColumnInfo[nColumn].ulColumnSize == sizeof(ctype));
void UpdateCol()
{
HRESULT hr;
char szColVal[] = "Newval";
CDataSource ds;
CSession ses;
hr = ds.Open("MSDASQL","Ram","sa","");
hr = ses.Open(ds);
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY,
DBPROPVAL_UP_CHANGE |
DBPROPVAL_UP_INSERT |
DBPROPVAL_UP_DELETE);
CTable< CDynamicAccessor > tb;
// Open a rowset on a table with Dynamic accessor
hr = tb.Open(ses,"Authors",&propset);
tb.MoveFirst();
tb.SetValue((ULONG)1L,(char *)szColVal);
// Call this function to set the data
hr = tb.SetData();
}
This code does not update the column with the given value.
void CMultipleDlg::OnUpdate()
{
HRESULT hr;
char szColVal[] = "Newval";
CDataSource ds;
CSession ses;
hr = ds.Open("MSDASQL","Ram","sa","");
hr = ses.Open(ds);
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY,
DBPROPVAL_UP_CHANGE |
DBPROPVAL_UP_INSERT |
DBPROPVAL_UP_DELETE);
CTable<CDynamicAccessor> tb;
// Open a rowset on a table with Dynamic accessor
hr = tb.Open(ses,"Authors",&propset);
tb.MoveFirst();
void *pName;
// Get the address of the buffer for the second column
pName = tb._GetDataPtr(1L);
// copy the string to be set to the buffer
strcpy((char *)pName,szColVal);
// Call this function to set the data
hr = tb.SetData();
}
Additional query words: kbDSupport
Keywords: kbtshoot kbprovider kbdatabase kbprb KB201390