It seems that we've stumbled upon a bug in the DataTable.Select method. I've been able to reproduce it but it only seems to occur when the select filter is formatted in a specific way. Here is the code to reproduce it:
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Exists", typeof(bool));
ds.Tables.Add(dt);
DataRow dr = dt.NewRow();
dr[0] = 1;
dr[1] = "Name 1";
dr[2] = true;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 2;
dr[1] = "Name 2";
dr[2] = false;
dt.Rows.Add(dr);
DataRow[] drs = ds.Tables[0].Select("((ID in (1,2))) AND ((Exists = 1)) AND (Exists = 0)", "ID");
Even though this should return no rows, it actually returns one. The problem seems to be that the second condition (Exists = 1) is ignored, and only the first and third conditions get evaluated. The only way this occurs is when both the first and second conditions are surrounded by more than one set of parenthesis.
Obviously the workaround is to get rid of the unnecessary parenthesis, however it does seem to be a bug that could cause nasty problems.
It looks like it has been fixed by Microsoft, and they have a hotfix that will fix this problem (I have verified it). The only problem is that you cannot just download this hotfix, you have to call them up and have them e-mail it. This is the knowledge base article: http://support.microsoft.com/default.aspx?scid=kb;en-us;891742