Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: ADO Recordbinding and Null values


Message #1 by mfonggit@u... on Tue, 7 Aug 2001 19:33:30
I am using ADO Recordbinding and when i read a null value from the 

database (from a text field 'name') if i try to update the value to some 

string value it never gets back to the database. the xml data section 

generated from the recordset looks like this:



<rs:data>

	<rs:update>

		<rs:original>

			<z:row number='0'/>

		</rs:original>

		<z:row rs:forcenull='name'/>

	</rs:update>

	<z:row name='RBU2a' number='1'/>

	<z:row name='RBU3z' number='2'/>

</rs:data>



why is rs:forcenull='name' being set?



if i dont use ado recordbinding and just use a datagrid it works fine and 

the xml looks like this with the updated value:



<rs:data>

	<rs:update>

		<rs:original>

			<z:row number='0'/>

		</rs:original>

		<z:row name='NewName'/>

	</rs:update>

	<z:row name='RBU2a' number='1'/>

	<z:row name='RBU3z' number='2'/>

</rs:data>



Any ideas? thanks in advance

here is the code for my binding class, update, and refresh stuff:



class CCustomRs : public CADORecordBinding  

{

BEGIN_ADO_BINDING(CCustomRs)

	ADO_VARIABLE_LENGTH_ENTRY2(1, adVarChar, m_szName, sizeof

(m_szName), m_lNameStatus, TRUE)

	ADO_FIXED_LENGTH_ENTRY(2, adInteger, m_lNumber, 

		m_lNumberStatus, FALSE)

END_ADO_BINDING()



public:



	LONG m_lNumber;

	ULONG m_lNumberStatus;



	CHAR   m_szName[51];

	ULONG   m_lNameStatus;



};



void CATL2ClientDlg::RefreshBoundData()

{

	if(adFldOK == m_crsBindSet.m_lNumberStatus)

		m_lNumber = m_crsBindSet.m_lNumber;

	else

		m_lNumber = 0;



	if(adFldOK == m_crsBindSet.m_lNameStatus)

		m_strRBUName = m_crsBindSet.m_szName;

	else

		m_strRBUName = _T("");



	UpdateData(FALSE);

}



void CATL2ClientDlg::UpdateBoundData()

{

	HRESULT hr;



	UpdateData(TRUE);



	if(m_strRBUName != m_crsBindSet.m_szName)

	{

		strcpy(m_crsBindSet.m_szName, (LPCTSTR)m_strRBUName);

		

	}



}


  Return to Index