CREATE PROCEDURE uspStaff_List@IsMgrID INT,@IsDeptID INT,@IsNotMgrID INT,@IsNotDeptID INTASSELECT StaffID, DeptID, StaffName, MgrIDFROM tblStaffWHERE MgrID = @IsMgrID AND MgrID <> @IsNotMgrID AND DeptID = @IsDeptID AND Deptid <> @IsNotDeptID
This is just a sample SQL query and you would pass in the parameters you want to filter.
Coincedentally, I came across this solution to select distinct, sort and filter a datatable.
Check out this post http://www.codeproject.com/useritems/SelectDistinct.asp on The Code Project. He mentioned that the object can take 40,000 records and turn them into around 2000 distinct records in a little over a second.
Not sure if it works in your case, but worth exploring.
eric_tcp: Is it possible to filter datatable based on another datatable or dataset?... Thanks.
Is it possible to filter datatable based on another datatable or dataset?...
Thanks.
I came out with an idea that pass the sql query to database for inner join the table which contains data I want, it is just take me few seconds.
eric_tcp:Will this iterating faster than datatview.Filter, which take more than 10 seconds to filter 1000 row of data?
I don't know since I was just penning down thoughts. Why don't you try it in experiments with your samples of data and collect and witness the results first hand?
The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral