Can we filter columns in a dataset ?

C

Chak

Just as we use RowFilter, to choose a subset of rows , i wish to get s
subset of the columns. The workaround i could think of was to read the
DataTable again with only required columns eg - SELECT COL1 FROM DT1 where
DT1 is the memory datatable.

1) Is it possible to apply a SELECT on a DataTable ?

2) How would one pick only the required columns after populating the dataset
?

Regards.
 
C

Cor Ligthert [MVP]

Chak,

For Net 1.x you can use the styles from a datagrid

For Net 2.0 you can beside that use the overloaded version from the
DataView.ToTable to create a seperated datatable.

I hope this helps,

Cor
 
M

Miha Markic [MVP C#]

Hi Chak,

Depends on the data consumer as this is a job for UI.
Which one are you using?
 
C

Chak

Thanks. Am using the Windows forms datagrid in 1.1

Regards,

Chak.


Miha Markic said:
Hi Chak,

Depends on the data consumer as this is a job for UI.
Which one are you using?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chak said:
Just as we use RowFilter, to choose a subset of rows , i wish to get s
subset of the columns. The workaround i could think of was to read the
DataTable again with only required columns eg - SELECT COL1 FROM DT1
where DT1 is the memory datatable.

1) Is it possible to apply a SELECT on a DataTable ?

2) How would one pick only the required columns after populating the
dataset ?

Regards.
 
M

Miha Markic [MVP C#]

I never use DataGrid (always a third party grid) as DataGrid is very limited
control.
Anyway, you might read this thread:
http://groups.google.com/group/micr...+group:*dotnet*&rnum=1&hl=sl#e8555f595f3bfd2e

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chak said:
Thanks. Am using the Windows forms datagrid in 1.1

Regards,

Chak.


Miha Markic said:
Hi Chak,

Depends on the data consumer as this is a job for UI.
Which one are you using?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chak said:
Just as we use RowFilter, to choose a subset of rows , i wish to get s
subset of the columns. The workaround i could think of was to read the
DataTable again with only required columns eg - SELECT COL1 FROM DT1
where DT1 is the memory datatable.

1) Is it possible to apply a SELECT on a DataTable ?

2) How would one pick only the required columns after populating the
dataset ?

Regards.
 
G

Guest

With the datagrid you can filter the column to show by defined Column mapping
Then you mapp only columns you need to show

Chak said:
Thanks. Am using the Windows forms datagrid in 1.1

Regards,

Chak.


Miha Markic said:
Hi Chak,

Depends on the data consumer as this is a job for UI.
Which one are you using?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Chak said:
Just as we use RowFilter, to choose a subset of rows , i wish to get s
subset of the columns. The workaround i could think of was to read the
DataTable again with only required columns eg - SELECT COL1 FROM DT1
where DT1 is the memory datatable.

1) Is it possible to apply a SELECT on a DataTable ?

2) How would one pick only the required columns after populating the
dataset ?

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top