BUG: DataRepeater Control does not Update Records (197428)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q197428 SYMPTOMS
When you use the DataRepeater control scroll bar to navigate through your
data-bound user controls, changes made to the fields in the user controls
are not saved to the database.
CAUSE
When the DataRepeater gets the DataSource, it passes the DataSource to its
BindingCollection. The BindingCollection gets the position of the current
row. The DataRepeater also gets the position of the current row. Normally,
the two rows should be the same; but in this case, they are not. Both calls
return the same recordset object, but they contain their own Current Row
information. When the user selects the current row in the DataRepeater, the
Binding Collection's row position does not move, therefore the data
bindings in the user-control does not get updated.
RESOLUTION
Use one of the following to work around this problem:
- Use a visible ActiveX Data Objects (ADO) data control (ADODC) to scroll through the bound user-controls.
- Use a hidden ADO data control (ADODC) on your form. Add a command button to save the changed record. Paste the following code in the Click event of the command button:
Private Sub SaveRecord_Click
Adodc1.Recordset.Move 0
End Sub
The following code should also work:
Private Sub SaveRecord_Click
If (Adodc1.Recordset.BOF) Then
Adodc1.Recordset.MoveNext
Adodc1.Recordset.MovePrevious
Else
Adodc1.Recordset.MovePrevious
Adodc1.Recordset.MoveNext
End If
End Sub
Moving to another record in the ADODC recordset ensures that the current
row's position of the BindingCollection is the same as the DataRepeater.
This causes the user-control to update successfully.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 3/14/2005 |
---|
Keywords: | kbBug kbCtrl kbDatabase kbDataBinding KB197428 |
---|
|