D
Dean Slindee
I have noticed that doing a datatable.reset() wipes out an "independently"
declared datarow copied from a single datatable row. What is curious is
that if a dataset is substituted for the datatable, the "independently"
declared datarow is not destroyed. Is this difference in operation of
datatable vs. dataset by design or a Microsoft error?
Private drOriginal As DataRow 'independently declared datarow within same
form
Form paint function, where drOriginal is loaded:
Public Sub FormPaint(ByVal intActivityID As Integer)
Dim dt As New DataTable
Dim dr As DataRow
dt = dal.GetUserActivityRowWithActivityID(intActivityID) 'returns 1
row
For Each dr In dt.Rows
drOriginal = dr
Next
dt.Reset()
'subsequent processing reusing dt is not shown
dt = Nothing
End Sub
When a subsequent event needs to use drOriginal, drOriginal is empty (a
result of dt.Reset())
Again, if a dataset had been used instead of the datatable, drOriginal would
be subsequently intact.
Thanks,
Dean Slindee
declared datarow copied from a single datatable row. What is curious is
that if a dataset is substituted for the datatable, the "independently"
declared datarow is not destroyed. Is this difference in operation of
datatable vs. dataset by design or a Microsoft error?
Private drOriginal As DataRow 'independently declared datarow within same
form
Form paint function, where drOriginal is loaded:
Public Sub FormPaint(ByVal intActivityID As Integer)
Dim dt As New DataTable
Dim dr As DataRow
dt = dal.GetUserActivityRowWithActivityID(intActivityID) 'returns 1
row
For Each dr In dt.Rows
drOriginal = dr
Next
dt.Reset()
'subsequent processing reusing dt is not shown
dt = Nothing
End Sub
When a subsequent event needs to use drOriginal, drOriginal is empty (a
result of dt.Reset())
Again, if a dataset had been used instead of the datatable, drOriginal would
be subsequently intact.
Thanks,
Dean Slindee