Click here to Skip to main content
15,302,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've spent significant amount of time looking around, however couldn't really find any solution to this:

I've got 4 tables: Category(id,Name),Product(id,Name,CategoryID),RatedProducts(id,Rating,ProductID,UserID), User(id,Name)

C++
              Category1                        Category2
Name  |   Product1  Product2  Product3    Product4   Product5   Product6
---------------------------------- ----------------------------------
Joe   |  Excellent   Good   Not Rated     Good       Good     Excellent
Jill  |    Good      Poor      Good       Poor       Poor       Good



Mind that product list changes over time as well as ratings and users, so it should all be dynamically populated. GridView must be updatable, user should be able to update Rating by changing the value in a dropdown.

I would prefer LINQ to SQL but any other way is ok.
Posted
Updated 20-Mar-12 8:15am
v3

my article about dynamic pivotting explains[^] it all.
   
Thanks,

C#
var result = from r in smdt.SM_RatedProducts
                   group r by new { r.SM_Product.Name, UserName = r.SM_User.Name, Category = r.SM_Product.SM_Category.Name, r.Rating } into prodGroup
                   orderby prodGroup.Key.UserName ascending
                   orderby prodGroup.Key.Category ascending
                   select new { prodGroup.Key.UserName, prodGroup.Key.Category, prodGroup.Key.Name, prodGroup.Key.Rating };


Mine one should not be as complicated though.

Anyone could give me a tiny hint on how to achieve above?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900