I'm new to C#, and I'm kinda clueless about how to use a single sql-string to retrieve data from multiple tables (3 of them, actually).
basically there are 2 master-files:
And 1 transaction-file:
And that's alright. But now i need to run a command that will retrieve data from ALL 3 tables based on a search-parameter entered by the user, and display selected fields in all of them. in ms access, all i had to do was make a query - here's the generated sql:
SELECT Assignments.Task_No, Assignments.Assignment_No, Assignments.Assignment_Date,
Task_Information.Client_Name, Emp_Information.F_Name, Emp_Information.L_Name
FROM Emp_Information
INNER JOIN (Task_Information
INNER JOIN Assignments ON Task_Information.Task_No = Assignments.Task_No)
ON Emp_Information.Emp_ID = Assignments.Assignee
WHERE (((Assignments.Assignment_Date)="this is just some date the user has to enter..."))
In short, I need to find out how to use the same sql-string in a C# program where the user types the search parameter and clicks a button. btw, it's got to be done with an oledbdatareader/adapter;
Try this query:
SELECT Assignments.Task_No, Assignments.Assignment_No, Assignments.Assignment_Date,
Task_Information.Client_Name, Emp_Information.F_Name, Emp_Information.L_Name
FROM Emp_Information
INNER JOIN Task_Information
ON Task_Information.Task_No = Assignments.Task_No
INNER JOIN Assignments
ON Emp_Information.Emp_ID = Assignments.Assignee
WHERE (((Assignments.Assignment_Date) like "%this is just some date the user has to enter...%"))