I’m performing multiple Selects on a dataset. The total #records from all of these selects ought to match the total number of records in the dataset, but doesn’t. (Total from all the selects is less.) I’ve read that .Net 1.1 Select had a bug w/ multiple AND conditions, but this is VS2005 & .Net 2.0.
Here’s the code: Note: Some row’s catagory values are not populated.
string Filter; Filter = 'Category = 'HIGH''; Response.Write('High: ' + dslErrors.Tables[0].Select(Filter).GetLength(0).ToString() + '<br>'); int TotalRecords = dslErrors.Tables[0].Rows.Count; //This is correct Filter = 'Category = 'MEDIUM''; Response.Write('Medium: ' + dslErrors.Tables[0].Select(Filter).GetLength(0).ToString() + '<br>'); Filter = 'Category = 'LOW''; Response.Write('Low Error Count: ' + dslErrors.Tables[0].Select(Filter).GetLength(0).ToString() + '<br>'); Filter = '((Category <> 'HIGH') AND (Category <> 'MEDIUM') AND (Category <> 'LOW'))'; Response.Write('Other: ' + dslErrors.Tables[0].Select(Filter).GetLength(0).ToString() + '<br>');
If there are any records for which
Categoryisdbnull, then they will not match and of the expressions you have listed.I suggest changing your last
filterto:The reason it doesn’t work is because comparisons with dbnull yield null rather than the expected false.