Changing the DataRowState Property

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???
 
M

Manoj G [MVP]

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)
 
D

Dennis Davitt

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???
 
D

Dennis Davitt

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???
 
D

Dennis Davitt

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???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top