Hello friends,
Please I need your help, I have this Query:
SELECT c.CategoryID , p.ProductID , c.CategoryName , p.ProductName FROM Categories as C INNER JOIN Products as PON c.CategoryID = p.CategoryID
I need to show a tree with the head of the Parent Category table and within the detail of the Product table.
Please friend, any idea?
Thanks, God Bless you.
Hi, thanks for your help, Please, I'm getting my data from each table in two different lists, but I obtain bad results, the PK from my Parent Table is is displayed several times. This is my code, please any idea.
Thanks, God Bless You.
Hello Eros,
Have you been able to resolve your issue ? Did you have a time to take a look at the attached sample. Please let me know if you have any questions.
Regards
There are different approaches to achieve the desired behavior. The first one is to split your query with Inner join to two different queries, without inner join. The first one will be select from your Categories table – Parent table, and second query (from Products) will be your child table. You could include both tables (the result set from your two queries) in DataSet. Then you could create a Relation between both tables using the same connection like it is in your Inner join.
Other approach could be by using directly the result set from your inner join (please note that by this was you will have duplicate items in your Categories table). I made small sample that shows the second approach. Please take a look at the attached sample for more details. Please let me know if you have any questions.