Community discussion forum

[C#] SQL "INNER join" in "Dataset"

  • 5 months ago

    Hi all, please help me with this: How to View the "INNER JOIN" in C# for example Customer(CustomerID, CustomerName) Order(OrderID, CustomerID, OrderDate, OrderAmount) A list of customer who made order of month could be easy collected by SQL query as below:

    select C.CustomerID, C.CustomerName, O.OrderAmount from Customer C join on Order O (C.CustomerID = O.Customer ID) where Month(O.OrderDate) = month(getdate())

    who can I do it in Dataset? for display purpose

    Dataset dsCustomerOrder = new Dataset("CustomerOrder"); DataTable dtCustomer = ....; DataTable dtOrder = ...; dsCustomerOrder.Tables.Add(dtCustomer); dsCustomerOrder.Tables.Add(dtOrder); DataRelation drCustomerOrder = new DataRelation("R_CustomerOrder", dtCustomer.Columns["CustomerID"], dtOrder.Columns["CustomerID"]; ............... I want to bind it to DataGird with following columns: CustomerID, CustomerName, CustomerOrder

    Thank you

    Looking forward to hearing for all you guys!

    Post was edited on 06/06/2009 17:18:50 Report abuse

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback