G
Guest
Hi everybody
I am trying to take an existing datarow from a datatable, modify its Primary Key value
and reinsert into the datatable as a NEW (datarowstate.added) row. The code below i
the track I have been pursuing, but I keep getting the error that the datarow already belong
to another table. This is despite the fact that I essentially murder the temporary datatable I create to
modify the datarow. Any suggestions
'Create new table and import current dataro
Dim dTable As New dsPatients.dtPatientsDataTabl
dTable.ImportRow(DsPatients1.dtPatients(0)
'Reset PtID to negativ
dTable(0).PtID = -
Dim dRowNew As DataRow = dTable(0
'Get rid of old tabl
dTable.Clear(
dTable.AcceptChanges(
dTable.Dispose(
dTable = Nothin
'Try to add modified row back t
'original table as a new ro
DsPatients1.dtPatients.AdddtPatientsRow(dRowNew
JT
I am trying to take an existing datarow from a datatable, modify its Primary Key value
and reinsert into the datatable as a NEW (datarowstate.added) row. The code below i
the track I have been pursuing, but I keep getting the error that the datarow already belong
to another table. This is despite the fact that I essentially murder the temporary datatable I create to
modify the datarow. Any suggestions
'Create new table and import current dataro
Dim dTable As New dsPatients.dtPatientsDataTabl
dTable.ImportRow(DsPatients1.dtPatients(0)
'Reset PtID to negativ
dTable(0).PtID = -
Dim dRowNew As DataRow = dTable(0
'Get rid of old tabl
dTable.Clear(
dTable.AcceptChanges(
dTable.Dispose(
dTable = Nothin
'Try to add modified row back t
'original table as a new ro
DsPatients1.dtPatients.AdddtPatientsRow(dRowNew
JT