B
Bob Day
Using VS 2003, VB.net, MSDE...
I am trying to 1) create and fill a detached datarow, 2) modify some of its
columns and 3) Update those modifications back to the datasource table. It
is step 3 that is failing, no errors, just 0 rows updated. I think the
problem lies in the fact that the datarow has a row state of "detached" (but
I am not sure how change that, since AddNewRow will create a new row, not
modify an existing one).
Step 1
Dim myDataRow as DataRow = Nothing
myDataRow = myDataAdapeter.Fill()
' myDataRow fills as expected
' I realize in Step 1 I could fill a dataset, set the DataRow = a row in
the dataset, thus making the RowState "Modified" , which then Updates
correctly in Step 3 (this may be the only way to do it).
Step 2
myDataRow.Column = New_Value
' myDataRow has New_Value as expected
Step 3
dim myDataRowArray() as DataRow = {myDataRow}
' myDataRowArray shows a length of 1, and the New_Value is in that 1 item as
expected
Rows_Updated = myDataAdapter.Update(myDataRowArray)
' Rows_Updated = 0, no error, not sure why.
So, why am I not getting anyting updated? I think the
Thanks!
Bob Da
I am trying to 1) create and fill a detached datarow, 2) modify some of its
columns and 3) Update those modifications back to the datasource table. It
is step 3 that is failing, no errors, just 0 rows updated. I think the
problem lies in the fact that the datarow has a row state of "detached" (but
I am not sure how change that, since AddNewRow will create a new row, not
modify an existing one).
Step 1
Dim myDataRow as DataRow = Nothing
myDataRow = myDataAdapeter.Fill()
' myDataRow fills as expected
' I realize in Step 1 I could fill a dataset, set the DataRow = a row in
the dataset, thus making the RowState "Modified" , which then Updates
correctly in Step 3 (this may be the only way to do it).
Step 2
myDataRow.Column = New_Value
' myDataRow has New_Value as expected
Step 3
dim myDataRowArray() as DataRow = {myDataRow}
' myDataRowArray shows a length of 1, and the New_Value is in that 1 item as
expected
Rows_Updated = myDataAdapter.Update(myDataRowArray)
' Rows_Updated = 0, no error, not sure why.
So, why am I not getting anyting updated? I think the
Thanks!
Bob Da