Create a dynamic table from datatable passed from c#
how can we dynamic create table through datatable which is passed from c# with the values
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ravi KumarRank #2,085 · 690 reputationPosted May 16, 2014, 4:30 AM EDT
try the fallowing code
DataTable dt=new DataTable();
dt.Columns.Add("BarCode", typeof(string));
dt.Columns.Add("ISBN", typeof(string));
dt.Columns.Add("QTY", typeof(int));
dt.Columns.Add("CP", typeof(double));
dt.Columns.Add("AMOUNT", typeof(double));
dt.Columns.Add("DISC", typeof(double));
dt.Columns.Add("CNAME", typeof(string));
dt.Columns.Add("CVALUE", typeof(double));