Make sure you are checking dv.Count not the count of the rows in the table.
They aren't the same if you set a rowfilter that filters anything out.
Here's the code recreated in C#. I used a new table and everything. I
already did it with your code and verified that it's the way you are
counting rows, but if you follow my comments, it should clear it up. Note
that this pass I have 2 rows with 1985.
private void button6_Click(object sender, System.EventArgs e)
{
//Created a Table "TestTable" in NorthWind
//With 5 records total. Two Columns, VehicleYear
//and IDCode - IDCode does nothing but serve
//as a dummy Key so I can add multiple years to test this
//properly. Two instances of 1985 are currently in the db
//As expected, after applying the filter, 2 records exist
//in the DataView (dv), 5 in the DataTable (dt or
dsTest.Tables[0]
DataSet dsTest = new DataSet();
sqlDataAdapter4.Fill(dsTest, "TestTable");
DataTable dt = dsTest.Tables[0];
DataView dv = dt.DefaultView;
MessageBox.Show(dt.Rows.Count.ToString());//5
dv.RowFilter = "VehicleYear = '1985'";
MessageBox.Show(dv.Count.ToString()); //2
}
--
W.G. Ryan MVP Windows - Embedded
http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/