views:

412

answers:

1

Hi All I have loaded three tables to my application. After the work is done, I want to save it all. Using 'for each' (is there a better way?), I recreated from my different class objects three data tables.

Now I have the tables, I think I added them to new ds

DataSet ds= new DataSet();
ds.Tables.Add(emp);
ds.Tables.Add(managers);
ds.Tables.Add(empToManagers);

Did I do it right?

Now my main question: in my db, I have three tables, some of the lines have been changed, deleted or some lines are new. What is the best way to update the db, without checking every line myself? I tried and got lost with the sql. Someone told me I can use adapter, but how?

When I open the data, It is easy to see adapter

public DataSet GetDataSet(string tblName, string sql, DataSet ds)
{
    adapter.SelectCommand.CommandText = sql;
    adapter.Fill(ds, tblName);
    return ds;
}

tnx

+1  A: 

This article might help

http://www.knowdotnet.com/articles/datasetmerge.html

Seth

Seth Spearman