sahil kumar

sahil kumar

  • NA
  • 14
  • 7.5k

updating database from dataset

Jul 6 2013 3:57 AM
DataSet ds1 = new DataSet();
 SqlDataAdapter da1 = new SqlDataAdapter("select * from registrar_packets", con);
 da1.Fill(ds1);
foreach(somthing)
{

 ds1.Tables[0].Rows.Add(filename, s1, flag);   //filename, s1,flag is variable
                    ds1.AcceptChanges();

}
//here all data is filled in dataset ds1

SqlCommandBuilder objCommandBuilder = new SqlCommandBuilder(da1);
                da1.Update(ds1.Tables[0]);     // database not updated



this is not updating my sqlserver database.
what wrong i am doing???


Answers (4)