QueriesTableAdapter
Visual Studion 2010, C Sharp
I have created a dataset 'FPdbDataset' with four tables and a QueriesTableAdapter 'wklysalesTableAdapter' which has the following SQL statement:
SELECT SUM(TransactionEntry.Quantity) AS Sold, DATEPART(WEEK, [Transaction].Time) AS WkNo,
TransactionEntry.ItemID AS ItmId, Item.Description AS Title,
Item.ItemLookupCode AS Code, Item.Quantity AS Stock
FROM TransactionEntry INNER JOIN
[Transaction] ON TransactionEntry.TransactionNumber = [Transaction].TransactionNumber INNER
JOIN
Item ON TransactionEntry.ItemID = Item.ID
WHERE (Item.DateCreated >= @Param1) AND (Item.DepartmentID = @Param2)
GROUP BY DATEPART(WEEK, [Transaction].Time), TransactionEntry.ItemID, Item.Description, Item.ItemLookupCode, Item.Quantity
ORDER BY ItmId, WkNo
The purpose of the select statement (which works fine), is to display the number of items sold per week based on their department. I have a Windows form with two grids: grid1 to display the departments and grid2 for the wklysales query. Grid1 works fine but I cannot find a way to fill grid2 with the results of the wklysales query based on the department selected in grid1 (via @Param2).
I'm a total newbie to this and would be extremely greateful for any assistance.
Rich
|