troubleshooting Question

converting sql to linq not working

Avatar of reddy999
reddy999 asked on
.NET ProgrammingC#
11 Comments1 Solution271 ViewsLast Modified:
public static DataSet GetItemLists(int group_code)
                          //converting following sql command to linq            
      //         string sql = "SELECT Distinct parent_sku, group_code, parent_sku, description "
      //                + "FROM item_view "
      //                + "WHERE group_code=@group_code ";

            using (WellsMusDataContext dc = new WellsMusDataContext())

               List<item_view> query1 = (from item in dc.item_views
                                     where item.group_code == group_code
                                     select item).Distinct().ToList<item_view>();

              //this is my custom class that converts list to dataset
                CollectionToDataSet<List<item_view>> c = new CollectionToDataSet<List<item_view>>(query1);
                return c.CreateDataSet();
but it gives repeating data which is not distinct Can any body help me on this?
thank you
Adam Menkes
C# ASP.NET Developer
Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros