Using vb.net, I created a data view and would like to filter the view and
determine if a record or group of records exists. My question..........is
there a property I can check to determine if the view contains records
meeting my criteria after filtering is performed? Also if the view does in
fact contain records, is there a way to loop through view to get certain
field values from it?


Wil.

Re: Advice on filtering and using a Data View by Scott

Scott
Sun Apr 25 10:50:40 CDT 2004

Yes to both questions...

Let's say I have a DataTable populated with all the authors from the
SQL Server authors table in the pubs database, and I set the Table
property of my DataView to this table.

Next, I set a filter to see only authors from the state of California:

dv.RowFilter = "state = 'CA'";

Then I can get a count of authors from CA with:

int count = dv.Count;

and I can loop through the records and print out the au_id field of
California authors with:

foreach(DataRowView drv in dv)
{
Console.WriteLine(drv["au_id"]);
}

HTH,

--
Scott
http://www.OdeToCode.com


On Sun, 25 Apr 2004 10:37:36 -0400, "Willie Neal" <kixman@excite.com>
wrote:

>Using vb.net, I created a data view and would like to filter the view and
>determine if a record or group of records exists. My question..........is
>there a property I can check to determine if the view contains records
>meeting my criteria after filtering is performed? Also if the view does in
>fact contain records, is there a way to loop through view to get certain
>field values from it?
>
>
>Wil.
>