I need to perform some operations on rows that match a certain criteria. The challenge is, to find them by the properties in other tables. I have been using DataRelation objects and expression columns, but my latest hurdle is that I have child tables that dont allow me to look "downstream". The best way to explain this is with an example I suppose...
Using the Northwind sample database, imagine you need to locate every Employee for a given region. That means you have to locate an Employee with Territory.TerritoryDescription = something. Ideally, it would be more user friendly if you could write code that was the equivalent of "give me all Employees who work in somewhere". Even better, be able to write queries with boolean expressions for the WHERE component such that you could narrow down employees who work in (territoryA AND territoryB).
With SQL, I can write a query like...
SELECT Employees.EmployeeID, Territories.TerritoryDescription
FROM Employees, EmployeeTerritories, Territories
WHERE Employees.EmployeeID = EmployeeTerritories.EmployeeID AND EmployeeTerritories.TerritoryID = Territories.TerritoryID AND Territories.TerritoryDescription = "something";
I need to be able to go a step further and filter by multiple territories, as in...
SELECT Employees.EmployeeID, Territories.TerritoryDescription
FROM Employees, EmployeeTerritories, Territories
WHERE Employees.EmployeeID = EmployeeTerritories.EmployeeID AND EmployeeTerritories.TerritoryID = Territories.TerritoryID AND Territories.TerritoryDescription = "something1" OR Territories.TerritoryDescription = "something2";
Can someone please show me how to do the same thing in C# and ADO.NET? I dont care if its a DataRow recordset or a DataView, I just need to be able to do this kind of query filtering.
Using the Northwind sample database, imagine you need to locate every Employee for a given region. That means you have to locate an Employee with Territory.TerritoryDescription = something. Ideally, it would be more user friendly if you could write code that was the equivalent of "give me all Employees who work in somewhere". Even better, be able to write queries with boolean expressions for the WHERE component such that you could narrow down employees who work in (territoryA AND territoryB).
With SQL, I can write a query like...
SELECT Employees.EmployeeID, Territories.TerritoryDescription
FROM Employees, EmployeeTerritories, Territories
WHERE Employees.EmployeeID = EmployeeTerritories.EmployeeID AND EmployeeTerritories.TerritoryID = Territories.TerritoryID AND Territories.TerritoryDescription = "something";
I need to be able to go a step further and filter by multiple territories, as in...
SELECT Employees.EmployeeID, Territories.TerritoryDescription
FROM Employees, EmployeeTerritories, Territories
WHERE Employees.EmployeeID = EmployeeTerritories.EmployeeID AND EmployeeTerritories.TerritoryID = Territories.TerritoryID AND Territories.TerritoryDescription = "something1" OR Territories.TerritoryDescription = "something2";
Can someone please show me how to do the same thing in C# and ADO.NET? I dont care if its a DataRow recordset or a DataView, I just need to be able to do this kind of query filtering.