rwallacej
asked on
Typed dataset select
Hi
I have typed dataset. Created this with XSD in VS 2010, called ProductionData. Note the data is not from a database, it is a strongly typed.
To bind it to a gridview on form I do this:
Dim ds = Me.ProductionData
DataGridView1.DataSource = ds
This binds all the fields. I'd like to bind only some e.g. Field1, Field2, Field3
Is there a "Select" statement one can do to only select a few fields?
Thanks in advance
I have typed dataset. Created this with XSD in VS 2010, called ProductionData. Note the data is not from a database, it is a strongly typed.
To bind it to a gridview on form I do this:
Dim ds = Me.ProductionData
DataGridView1.DataSource = ds
This binds all the fields. I'd like to bind only some e.g. Field1, Field2, Field3
Is there a "Select" statement one can do to only select a few fields?
Thanks in advance
ASKER
hi,
I'd like to keep the Gridview AutoGenerateColumns at True, and do a SELECT statement on the dataset (I presume there is a way to do this?)
thanks
I'd like to keep the Gridview AutoGenerateColumns at True, and do a SELECT statement on the dataset (I presume there is a way to do this?)
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for more info
I see there is a .Select function on the custom dataset
Me.ProductionData.Select (.......)
can this be used to select only particular columns, and so not have to recreate table?
I see there is a .Select function on the custom dataset
Me.ProductionData.Select (.......)
can this be used to select only particular columns, and so not have to recreate table?
The Select method can be used to filter rows not columns. It wil return array of DataRows based on the condition given.
The DataSet/DataTable does not have a built-in feature to filter columns.
The DataSet/DataTable does not have a built-in feature to filter columns.
ASKER
thank-you for help
GridView.Columns[3].Visibl
If you are using bound and template columns in GridView and AutoGenerateColumns is set to false, the GridView will display only those bound columns though the DataSet has many columns.