Data table
how manually create the table in windows form application?
2 Answers
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
Blocked AccountRank #403 · 6.2K reputationPosted Apr 19, 2011, 12:26 AM EDT
First of all add the namespace System.Data;
DataTable dataTable = new DataTable();
dataTable.Columns.Add("Name", typeof(string));
dataTable.Columns.Add("City", typeof(string));
dataTable.Columns.Add("Age", typeof(int));
// Here I add three DataRows.
dataTable.Rows.Add("Manish", "New Delhi", 28);
dataTable.Rows.Add("Santosh", "Noida", 35);
dataTable.Rows.Add("Puru", "Firojabad", 29);
now your datatable is ready for use.
Sam HobbsRank #107 · 20.5K reputationPosted Apr 19, 2011, 1:19 PM EDT