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

dataset , csharp , inner join Pasadena, United States
  • 6 years 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 a reply

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

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


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout