Hello,
How dynamaically add columns to sql datatable ?Columns counts may be different.it is not defined.
Thanks in advance.
Sql datatable columns
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
Ashish ShuklaRank #458 · 5.5K reputationPosted Mar 24, 2013, 2:39 AM EDT
dt.Columns.Add("TestColumn",typeof(string));
dt refers to an existing datatable.
To set the value we can use dr["TestColumn"] ="Turan"
Plese let me know if this answers your question