none
Linq query RRS feed

  • Question

  • Hi all

    Any Idea?

    Am working on a project of business logic. I need to prepare a report for my customers so that I am using Linq to SQL. To prepare a report I need to use eight entity classes. From these, two of them has foreign keys for some of the tables. I want to categries the report by sales session which has a forien key for  machine, location sold header tables. Therefore the sold header table also has foreging key for sales  and settlement tables. In Sold header and sales tables there are departments(this departments sometimes not the same department with the settlement and sales). Therfore I want the report should categories by sales session Id(which is hidden) and in each sales session the departments will come with all their sales and settlements. I have a colums of sales amount and settlement amount.  Still now I can filter out to display all departments with thier corresponding sales and settlement amount but not categorise under sales session Id.

    eg.     sales session Id                               Sum(sales amount)         sum(settlement amount)
                   Department A                                 sales amount                     settlement amount
                   Department B                                     ""                                          ""
             Sales Session ID                                Sum(sales....)                Sum(Settlement.....)
                  Department A                                    sales...                         settlement

    Thank you.

    Friday, October 2, 2009 1:17 PM

Answers

  • Hi Caleyudebi,

     

    If you want to finish this complex query, you can firstly make clear of the relationships between the eight tables and the query structure. Then choose the proper LINQ operator for it.

    Here are many LINQ examples for your referece,

    http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx

     

    If you have questions about one certain step, please post the code you already have and the tables’ schemas.

     

     

    Best Regards

    Yichun Feng


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Proposed as answer by Yichun_Feng Thursday, October 8, 2009 8:27 AM
    • Marked as answer by Yichun_Feng Friday, October 9, 2009 1:31 AM
    Tuesday, October 6, 2009 8:05 AM