using System.Data;
(1) Create a DataTable
(1) Create a DataTable
DataTable dt = new DataTable("TableName");
(2) Add columns for DataTable
//Method 1
dt.Columns.Add("column0", typeof(string));
//Method 2
DataColumn dc = new DataColumn("column1", typeof(bool));
dt.Columns.Add(dc);
(3) Add rows for DataTable
//Initialize the row
DataRow dr = dt.NewRow();
//Arrange data to dr(row1)
dr["column0"] = "AX";
dr["column1"] = true;
//Add row dr to GridTable
dt.Rows.Add(dr);
//Doesn't initialize the row
DataRow dr1 = dt.NewRow();
dt.Rows.Add(dr1);
(4) Delete rows
dt.Rows[this.dataGrid1.CurrentRowIndex].Delete();