DataSet refresh after Update

F

Freestyler

Let say there is a DataSet containing some data given by SQL command from
SQLServerCE database.
This DataSet we bind to a control that Shows the data.
Than (somehow) we modify showed data in database (by UPDATE for example).

Do we need to reload the DataSet or control to see the changes?
If Yes what are the tricks not to refresh whole DataSet, but only changed
row(s)?

Thanks
Freestyler
 
J

Jon Skeet [C# MVP]

Freestyler said:
Let say there is a DataSet containing some data given by SQL command from
SQLServerCE database.
This DataSet we bind to a control that Shows the data.
Than (somehow) we modify showed data in database (by UPDATE for example).

Do we need to reload the DataSet or control to see the changes?

Yes. DataSets are disconnected from the database.
If Yes what are the tricks not to refresh whole DataSet, but only changed
row(s)?

Well, you could keep a "last modified" timestamp in the database, and
only fetch things with a timestamp later than the last fetch time...
 
F

Freestyler

Let say there is a DataSet containing some data given by SQL command from
Yes. DataSets are disconnected from the database.

Really? I heard that there is a possibility to put some input or update
commands or stored procedures dealing with hanges saved to DataSet.
Is it not supported in CF?

Regards
Freestyler
 
I

Ilya Tumanov [MS]

It is supported (see DataAdapter class) and works the same way as on the
desktop.
However, DataSet is not a live connection to the database; it's an offline
in memory database.
DataAdapter is used to move data between DataSet and database and it's not
automatic.
If you want a live cursor (which might be appropriate with SQL CE),
consider using DataReader class instead.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 

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