NoCoolHandle
Programmer
Hi.
I have a webpage that reads an xml file into a dataset. This dataset can then be filtered by adding a dataview to the dataset and then setting the rowfilter property.
I have set the dataview.allowupdates=true.
When a textbox's text is changed, the change is written to the dataview.
When I save the underlying dataset back to the hard drive though, the changes are lost.
I have tried calling the datatables "acceptChanges" method, but this fails also...
Any clues would be appreciated.
code below
Rob
I have a webpage that reads an xml file into a dataset. This dataset can then be filtered by adding a dataview to the dataset and then setting the rowfilter property.
I have set the dataview.allowupdates=true.
When a textbox's text is changed, the change is written to the dataview.
When I save the underlying dataset back to the hard drive though, the changes are lost.
I have tried calling the datatables "acceptChanges" method, but this fails also...
Any clues would be appreciated.
code below
Rob
Code:
If fName = "" Then fName = DropDownList1.SelectedValue
Dim t As TextBox = sender
Dim iR As Integer = CInt(Val(t.ID.Replace("lbl", "")))
Dim iC As Integer = t.ID.Substring(t.ID.LastIndexOf("_") + 1)
Dim ds As New DataSet
ds.ReadXml(fName)
'WE need to run filters.
Dim dv As New DataView(ds.Tables(0))
dv.AllowEdit = True
If cmbFields.SelectedValue <> "" And txtFilter.Text.Trim <> "" Then
dv.RowFilter = cmbFields.SelectedValue & " like '%" & txtFilter.Text & "'"
End If
Try
[green] 'iR is the RowNumber and iC is the column number. This is stored in the textbox's id when it is generated.[/green]
dv.Item(iR)(iC) = t.Text
Catch
End Try
RunAsAdmin()
ds.Tables(0).AcceptChanges()
ds.WriteXml(fName)
dv.Dispose()