Changing the DataRowState Property

  • Thread starter Thread starter Dennis Davitt
  • Start date Start date
D

Dennis Davitt

I am trying to force update a DataSet which I retrieve via a Web Service.
All the rows in the DataSetRowState are "unchanged". Since this property is
read-only, I cannot use the DataAdapter.Update() method. How can I override
the DataRowState Property since it is Read-Only???
 
Hi,

You can trick the DataAdapter by updating one of the columns to its own
value. This way the RowState changes to Modified and hence your problem
should be solved!
Something like:

ds.Tables(0).Rows(0).Item(0) = ds.Tables(0).Rows(0).Item(0)
 
A hack but it works!!! Thanks.

Manoj G said:
Hi,

You can trick the DataAdapter by updating one of the columns to its own
value. This way the RowState changes to Modified and hence your problem
should be solved!
Something like:

ds.Tables(0).Rows(0).Item(0) = ds.Tables(0).Rows(0).Item(0)


--
HTH,
Manoj G [.NET MVP]
http://www15.brinkster.com/manoj4dotnet

Dennis Davitt said:
I am trying to force update a DataSet which I retrieve via a Web Service.
All the rows in the DataSetRowState are "unchanged". Since this property is
read-only, I cannot use the DataAdapter.Update() method. How can I override
the DataRowState Property since it is Read-Only???
 
I am not able to get the index value of the row using the syntax below. I
tried the importRow but the state is set to unchanged! Any suggestions.


Dennis Davitt said:
A hack but it works!!! Thanks.

Manoj G said:
Hi,

You can trick the DataAdapter by updating one of the columns to its own
value. This way the RowState changes to Modified and hence your problem
should be solved!
Something like:

ds.Tables(0).Rows(0).Item(0) = ds.Tables(0).Rows(0).Item(0)


--
HTH,
Manoj G [.NET MVP]
http://www15.brinkster.com/manoj4dotnet

Dennis Davitt said:
I am trying to force update a DataSet which I retrieve via a Web Service.
All the rows in the DataSetRowState are "unchanged". Since this
property
is
read-only, I cannot use the DataAdapter.Update() method. How can I override
the DataRowState Property since it is Read-Only???
 
I fixed:

dr[0] = dr[0]


Dennis Davitt said:
I am not able to get the index value of the row using the syntax below. I
tried the importRow but the state is set to unchanged! Any suggestions.


Dennis Davitt said:
A hack but it works!!! Thanks.

Manoj G said:
Hi,

You can trick the DataAdapter by updating one of the columns to its own
value. This way the RowState changes to Modified and hence your problem
should be solved!
Something like:

ds.Tables(0).Rows(0).Item(0) = ds.Tables(0).Rows(0).Item(0)


--
HTH,
Manoj G [.NET MVP]
http://www15.brinkster.com/manoj4dotnet

I am trying to force update a DataSet which I retrieve via a Web Service.
All the rows in the DataSetRowState are "unchanged". Since this property
is
read-only, I cannot use the DataAdapter.Update() method. How can I
override
the DataRowState Property since it is Read-Only???
 
Back
Top