4
Reply

how to add column in datatable in c# with default value c#?

Mani Kandan

Mani Kandan

Jun 29 2016 5:17 AM
1.4k
Sir,
 
adp.Fill(ds);
After fill the database items, I want to add extra coloum with new arraylist values
DataRow drr = ds.Tables[0].NewRow();
ds.Tables[0].Columns.Add("Column1", typeof(string));
ArrayList listArr = new ArrayList();
listArr.Add(SchemeColorValues.Accent1);
listArr.Add(SchemeColorValues.Accent2);
listArr.Add(SchemeColorValues.Accent3);
listArr.Add(SchemeColorValues.Accent4);
foreach (var data in listArr)
{
//How can fill listArr each value here to datatable coloum name 'Column1'?
}
dt = ds.Tables[0];
Kindly replay me.

Answers (4)