RohitYadav
asked on
creating a DataView with just one column from the DataTable
Hi,
I have a DataTable consisting of three columns.
I want to create a DataView which consists of first column of that dataTable.
I am fairly new to DataView and i now how to select particular rows based on a condition but not aware how to select a full column.
Thanks
I have a DataTable consisting of three columns.
I want to create a DataView which consists of first column of that dataTable.
I am fairly new to DataView and i now how to select particular rows based on a condition but not aware how to select a full column.
Thanks
dataview1.Table.Columns.Ad d(dataTabl eOne.Colum ns(0)) or dataview1.Table.Columns.Ad d(dataTabl eOne.Colum ns("TitleO fColumn"))
ASKER
Does not work. says object reference set to an Object.
It makes sense because the syntax you provided me adds a new column to the datatable that dataview depicts. I
I want my dataview to have just one column, I think we are supposed to use the constructor. But i am not sure about the "string rowfliter" parameter. Any other ideas?
It makes sense because the syntax you provided me adds a new column to the datatable that dataview depicts. I
I want my dataview to have just one column, I think we are supposed to use the constructor. But i am not sure about the "string rowfliter" parameter. Any other ideas?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I got the solution, You can use DefulatView.ToTable and specify the columns you want.
Thanks all who tried to help.
Thanks all who tried to help.
You got object reference not set to an instance of an Object because you didnt declare the object as New