Hi,
you can try code something like this below:
DataTable dt = new DataTable();
DataColumn col1 = new DataColumn();
DataColumn col2 = new DataColumn();
col1.ColumnName = "Name";
col2.ColumnName = "Age";
col1.DataType = typeof(System.String);
col2.DataType = typeof(System.Int32);
col2.ColumnMapping = MappingType.Hidden;
dt.Columns.Add(col1);
dt.Columns.Add(col2);
DataRow row1 = dt.NewRow();
row1["Name"] = "manih bafna";
dt.Rows.Add(row1);
dataGrid1.DataSource = dt;
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
"ci*********@gmail.com" wrote:
Hi everybody,
Supposing I have a DataTable with the following columns ["A", "B",
"C", "D"].
I need to copy that DataTable with all its data but filtered by
columns, that is I want
to have a new DataTable with all rows and the columns ["A", "C"].
What can I do?
Bye!