none
report designer use IEnumerable RRS feed

  • Question

  • I have a function like this:
            public IEnumerable GetClientsReferredButNoHired()
            {
                return from c in db.Clients
                       from p in c.Placements
                       where 0 == 0
                       && p.DateReferred != null
                       && p.DateHired == null
                       select new
                       {
                           CaseNumber = c.CaseNumber,                       
                           DateReferred =p.DateReferred
                       };
            }

    When I want to create a rdlc file and supply datasource with this function, however, the datasource view window does not give me this datasource.

    How do I create a report that has a table and get those values displayed? I think if I create a stored procedure, that might give me a datasource. but I rather use linq to get the datasource.

    thank you very much!
    Thursday, August 6, 2009 8:40 PM

Answers

All replies

  • It might help to return the generics IEnumerable (IEnumerable<>) so that the data source window has strong type information.  These samples also do what you are looking for and may be a useful reference.

    Webforms:
    http://msdn.microsoft.com/en-us/library/ms251692(VS.80).aspx

    Winforms:
    http://msdn.microsoft.com/en-us/library/ms251784(VS.80).aspx

    • Marked as answer by Riquel_DongModerator Friday, August 14, 2009 10:50 AM
    • Unmarked as answer by Meidi Friday, August 28, 2009 5:38 PM
    • Marked as answer by Meidi Friday, April 9, 2010 4:34 PM
    Wednesday, August 12, 2009 3:04 AM
    Moderator
  • I don't want to have a strong data type to show in the website data sources. There are so many reports I need. I do not want to generate a class just for the report. that would seem to be very redundant. I also do not want to create stored procedures since all the queries are done in LINQ already. I still cannot find where I can just have a table in the report viewer, without any data source binding in the design time. but use the code and dynamically bind the data source. thanks for your help.
    Friday, August 28, 2009 5:38 PM