Update DataTable in DataSet

S

SMG

Hi there,
We have a DataSet with one datatable with three columns and multiple
rows. [Each rows has a unique key]

1st Column : Unique Key
2nd Column : Value to Change
3rd Column : Value to Change

Based on some conditions I want to update the values of the 2nd and 3rd
column but want to keep the dataset intact.
It should just change the values.

I tried with first filtering the dataset with select method, but returns an
array of rows which is separate than my dataset.

I want to use the same dataset with the changed values.


Regards,
Shailesh
 
G

Guest

Hi SMG,

Try the following;

if you have an untyped dataset;
MyTable.Select("My Select Statement")[0]["MyColumn"] = MyValue;
if you have a typed dataset
lMyTable.FindByMyPrimaryColumn(MyColumnId).MyProperty = MyValue;

As far as I know, select statement does not return a copy, it returns a
reference to the row(s). So any change you make on these will affect the
dataset.

Hope this helps,

Ethem
 
S

SMG

Hi Ethem,
Thanks, that works

Shailesh

Hi SMG,

Try the following;

if you have an untyped dataset;
MyTable.Select("My Select Statement")[0]["MyColumn"] = MyValue;
if you have a typed dataset
lMyTable.FindByMyPrimaryColumn(MyColumnId).MyProperty = MyValue;

As far as I know, select statement does not return a copy, it returns a
reference to the row(s). So any change you make on these will affect the
dataset.

Hope this helps,

Ethem
 

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

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,743
Latest member
WoodrowMea

Latest Threads

Top