select certain columns of a data table

后端 未结 6 690
鱼传尺愫
鱼传尺愫 2020-12-09 09:20

I have a datatable and would like to know if its possible for me to select certain columns and input the data on a table. the columns are set out as below

|col1 |col

6条回答
  •  情深已故
    2020-12-09 09:33

    The question I would ask is, why are you including the extra columns in your DataTable if they aren't required?

    Maybe you should modify your SQL select statement so that it is looking at the specific criteria you are looking for as you are populating your DataTable.

    You could also use LINQ to query your DataTable as Enumerable and create a List Object that represents only certain columns.

    Other than that, hide the DataGridView Columns that you don't require.

提交回复
热议问题