Crystal Report and LINQ Object RRS feed

  • Question

  • Using VB in VS2008 I have created a datasource from a SQL table. I created the data source via "Add New Item - LINQ to SQL Class"and then "Add data source". I can drag this data source onto my form to create a data grid (as in video tutorial from Beth Massi) and when run all is fine. Data displays correctly. When I create a Crystal Report I have the following problems:

    1. I have the data source created above (from the .Net Objects of Project Data in CR Database Expert) as the selected table for my report. I can drag and drop fields from this (as displayed in the Field Explorer of CR) onto my report. I can do other CR design things as well (add text objects, add groups, etc). When I use the Report Preview (in CR designer) the report is produced by the data in the report is wrong. There is one more detail line on the report than rows in the underlying table and field values are incorrect.

    2. I add a CrystalReportViewer control to the Windows form and bind it to the Crystal Report. In the control in the form designer I see the same incorrect data as in the CR designer preview. Then when I run the application the viewer contains a report (with column headings, date printed BUT NO DATA.

    I think the setup of the LINQ to SQL is OK as it functions properly with the data grid. There seems to be a problem with how I have bound this to the Crystal Report and/or failing to populate/bind the LINQ to SQL object in the code (in load form??)

    Can't find the answer in MSDN search so any suggestions/advice welcome.
    Thursday, January 22, 2009 9:45 AM