I want to select one column in an DataTable in C#, this column should be transform also in an DataTable.
This is what I want.
DataTable(many columns) > select one column > convert this column to a DataTable again
I have try this, but this give me the complete DataTable back.
DataTable dt = defindedDataTable.Columns[0].Table;
You can get the DataView from your table and then use the DataView.ToTable Method. With this method, you can select one or more column you want:
DataTable dt = defindedDataTable.DefaultView.ToTable(false, defindedDataTable.Columns[0].ColumnName);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With