hi,
Please show me how to write data from a table in a database to xml and loading or inserting xml data to database(reverse process).
I don't have any idea of this problems.
I have Tried my level best,but failed to do so..
please show me how to copy data from 1 database to another databse ..
Anyone please Help me:'(
Anyway ThAnkS in Advance...:$

Use DataSet class,

// Populate DataSet using Database
    SqlDataAdapter adp = new SqlDataAdapter("select * from tableName", "your_conn_str");
     DataSet ds=new DataSet("MyDB");
     adp.Fill(ds,"tableName");
 
     // Write Data into XML
        ds.WriteXml("file.xml");
// Load(Read) XML data

          DataSet ds=new DataSet();
          ds.ReadXml("file.xml");
          DataTable dt=ds.Tables["tableName"];
          dt.Rows.Add("val1","val2"); // Adding row
// Update database
           SqlDataAdapter adp=new SqlDataAdapter("select * from tableName","your_conn_str");
           SqlCommandBuilder cb = new SqlCommandBuilder(adp);
           DataSet ds = new DataSet();
           ds.ReadXml("file.xml");
           DataTable dt = ds.Tables["tableName"];
           dt.Rows.Add("val1", "val2"); // Adding row
           adp.Update(ds, "tableName");
This article has been dead for over six months. Start a new discussion instead.