المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Adding values to datatable



C# Programming
08-27-2009, 04:23 PM
want to add new values to datatable rows on each button_click event..i want it in such a way that the new data gets added to the next row,instead of overwriting the first...Below is the code which i wrote
Button_Click event()

{OleDbDataAdapter da_pay = new OleDbDataAdapter();
DataSet ds_pay = new DataSet();
con2.Open();
da_pay.SelectCommand = pay_cmd2;
da_pay.Fill(ds_pay ,"details");

pay_dt=ds_pay .Tables ["details"];
pay_dt.Rows.Add();
con2.Close();}
But for every button click event the first row hets overwritten