SgDotNet
Singapore Professional .NET User Group -For Cool Developers

Filter datatable based on another datatable

This post has 18 Replies | 2 Followers

Top 25 Contributor
Posts 157

CREATE PROCEDURE uspStaff_List
@IsMgrID INT,
@IsDeptID INT,
@IsNotMgrID INT,
@IsNotDeptID INT
AS
SELECT StaffID, DeptID, StaffName, MgrID
FROM tblStaff
WHERE 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.

Top 25 Contributor
Posts 157

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.

Top 50 Contributor
Posts 67
eric_tcp:

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.

Top 10 Contributor
Posts 2,284

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

Page 2 of 2 (19 items) < Previous 1 2 | RSS
Copyright SgDotNet 2004-2008
Powered by Community Server (Commercial Edition), by Telligent Systems