private void _AddRow() { if (dsGrid.Tables.Count == 0) { DataTable table = new DataTable(); table.Columns.Add("ColumnId", typeof(int)); table.Columns.Add("QueryId", typeof(int)); table.Columns.Add("TableId", typeof(int)); table.Columns.Add("TableName", typeof(string)); table.Columns.Add("ApexColumnName", typeof(string)); table.Columns.Add("Expression", typeof(string)); table.Columns.Add("GroupBy", typeof(bool)); // The checkbox column dsGrid.Tables.Add(table); grdData.DataMember = dsGrid.Tables[0].TableName; grdData.DataSource = dsGrid.Tables[0]; } DataRow NewRow = dsGrid.Tables[0].NewRow(); NewRow["QueryId"] = _QueryId; dsGrid.Tables[0].Rows.Add(NewRow); }