How to filter a dataview

Posted by dboarman-FissureStudios on Stack Overflow See other posts from Stack Overflow or by dboarman-FissureStudios
Published on 2010-05-25T14:24:01Z Indexed on 2010/05/25 15:21 UTC
Read the original article Hit count: 480

Filed under:
|
|

I have a dataview that contains a list of tables. I am reading in a list of values that I then want to apply as a filter to this dataview. The list of values is actually in the form of "table1, table2, table3". So I thought I would be able to use this as a filter on my dataview.

SqlOp.CommandText = "select name from dbo.sysobjects where xtype='u'";
SqlOp.ExecuteDataReader();
DataView dv = SqlOp.GetDataAsDataView();
SqlOp.CloseConnection();

Returns a list of all the tables in a dataview. Any help on how to filter this dataview?

Edit:
Not sure if I was completely clear in what I seek to accomplish. To clarify, I am trying to figure out how/if .RowFilter will help me in filtering this dataview. Something like:

dv.RowFilter = "name IN (table1, table2, table3)"    // I know this doesn't work

© Stack Overflow or respective owner

Related posts about c#

Related posts about dataview