Bon La Lay
October 10th, 2001, 07:03 AM
I build a ActiveX Control which called MyControl.ocx. It contains one Usercontrol
named IntField which is used to receive integer input. It has a property Value. And
I use menu Tools->Procedure Attributes set the Data Binding of property Value as
"Property is data bound->This property binds to DataField & Updatae immediatly". So
when I use this control I can set the DataSource and DataField of it. Now here comes
the problem:
When I add an ADO Data Control and assign it as the DataSource of my Control (call it
IntField1) at the design time, then excute it. I can get the data from database and
change freely. All the thing runs fine. But if I assign the ADO Data Control as the
DataSource of IntField1 in my code (in the Form_Load Event for example). Only the first
time I change the Value of IntField1 and call ADODC1.Recordset.Update can really update
the database. After that, I cannot update database any more! I add some code in the
IntField_Change() Event to check the ADODC1.Recordset Status (Debug.Print ADODC1.Recordset.EditMode)
found that the first time when I change the value in IntField1, debug window said "1". after
I clicked the Update button then change the value again, debug window always said "0". Means
I cannot enter the EditMode any more.. Why? Is there missed something when I use Data binding?
Please help me.
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//
named IntField which is used to receive integer input. It has a property Value. And
I use menu Tools->Procedure Attributes set the Data Binding of property Value as
"Property is data bound->This property binds to DataField & Updatae immediatly". So
when I use this control I can set the DataSource and DataField of it. Now here comes
the problem:
When I add an ADO Data Control and assign it as the DataSource of my Control (call it
IntField1) at the design time, then excute it. I can get the data from database and
change freely. All the thing runs fine. But if I assign the ADO Data Control as the
DataSource of IntField1 in my code (in the Form_Load Event for example). Only the first
time I change the Value of IntField1 and call ADODC1.Recordset.Update can really update
the database. After that, I cannot update database any more! I add some code in the
IntField_Change() Event to check the ADODC1.Recordset Status (Debug.Print ADODC1.Recordset.EditMode)
found that the first time when I change the value in IntField1, debug window said "1". after
I clicked the Update button then change the value again, debug window always said "0". Means
I cannot enter the EditMode any more.. Why? Is there missed something when I use Data binding?
Please help me.
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//