microkarl Posted February 4, 2005 Posted February 4, 2005 All, Is it possible to have a dataview to filter out a datatable like this. A datatable has 5 rows with ID 1, 2, 3, 4, 5 I want to have a dataview to filter out ID 1, 3, 4 so I can only see 2, 5. Thanks Quote Donald DUCK : YOU ARE FIRED!!!
tate Posted February 4, 2005 Posted February 4, 2005 Will the number of the records to filter for change? If so, you may look at the possibility of using parameters as part of your SQL filter (WHERE) statement that is used to fill your dataset. Quote
microkarl Posted February 4, 2005 Author Posted February 4, 2005 No.. not that I know of, at least!! Yes, using SQL to filter out rows would be THE best way, however, it won't work in my case here due to some sort of business rule. So the question is still remain the same, is it possible to filter out a datatable like what I said before. Many thanks!! Quote Donald DUCK : YOU ARE FIRED!!!
Administrators PlausiblyDamp Posted February 4, 2005 Administrators Posted February 4, 2005 Have you tried using the DataView's Rowfilter property and use an IN clause for the criteria? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ombun2 Posted February 14, 2005 Posted February 14, 2005 yeah, referring to what PlausiblyDamp said, set your dv.RowFilter property to a string such as AssetID LIKE '*0*' AND EmployeeID LIKE '*1*' AND DepartmentID LIKE '*3*' that creates a filter where the values in the columns must CONTAIN (even more powerful than EQUAL) the values '0' '1' and '3' you can create some really powerful stuff...to read more about this, in your VS.NET index type this exactly "DataColumn.Expression property" however be careful where those values that you're searching for come from. If it's all done programatically, it's ok, but if you accept text from the user VALIDATE it 1000 times before you pass it to your database. Read up more on SQL Injection Attacks...freaky stuff. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.