After querying from database, I fill the result into dataset, suppose there are 10 columns.
And then i have to show 5 of the 10 columns into datagridview.
My way is to create a new DataTable with the 5 columns, and copy the value from the开发者_JAVA百科 original dataset. It works, but i don't think it's a good way.
Any suggestion?
----------------------- I am using C# for Form Application. I prefer programic way to implement.You can hide selected column by setting Visible to false, like datagridview.Columns[0].Visible = false
Assuming that you set the dataset as the datasource of the gridview, you can specify which columns do you want to display in the gridview by clicking on the > button in the design view and selecting edit columns.
Please see the following article: http://msdn.microsoft.com/en-us/library/ms972948.aspx
精彩评论