How to Create a Datatable In C#
Step 1 :
Declare A Datatable
Ex
DataTable Dt = new DataTable();
Step 2:
Create a Datatable Columns
Ex
DataColumn RollNo= new DataColumn();
DataColumn Name= new DataColumn();
DataColumn Std= new DataColumn();
DataColumn BDate= new DataColumn();
RollNo.ColumnName = "RollNo";
Name.ColumnName = "Name";
Std.ColumnName = "Std";
BDate.ColumnName = "BDate";
Dt .Columns.Add(RollNo);
Dt .Columns.Add(Name);
Dt .Columns.Add(Std);
Dt .Columns.Add(BDate);
Step 3:
Create A row And Fill It
Ex
DataRow row;
row = Dt.NewRow();
row["RollNo"] ="1";
row["Name"] = "Vicky";
row["Std"] = "12Std";
row["BDate"] ="17-11-1990";
Dt.Rows.Add(row);
-----------------------------------------------------------------
Brijesh Kumar Prajapati
Jr.Software Devloper,
Softyoug Solution Pvt Ltd
Vapi,
Gujarat,
India