none
Entity Data Model and Crystal Reports RRS feed

  • Question

  • Hi - I've a simple report form that has a few buttons for different reports. When a button is clicked i'm doing this:

    private void btnStatutoryDirectorsListing_Click(object sender, EventArgs e)
    {
       frmStatutoryDirectorsListing frmStatutoryDirectorsListing = new frmStatutoryDirectorsListing() { StartPosition = FormStartPosition.CenterScreen };
       frmStatutoryDirectorsListing.Show();
    }

    within the load event of frmStatutoryDirectorsListing i'm doing the following to display my report:

    private void frmStatutoryDirectorsListing_Load(object sender, EventArgs e)
    {
       StatutoryDirectorsListing rptStatutoryDirectorsListing = new StatutoryDirectorsListing();
       crystalReportViewer1.ReportSource = rptStatutoryDirectorsListing;
    }

    The datasource for this report is 2 entities from my EDM, at the minute I just want to display a couple of fields from each entity but when I run the application and click the button to display the report, I am being asked for a Database login? Can I set my project up so that the report is automically logged onto the DB?

    Are there any tutorials online that can show me how to set an entity to be the data source for my Crystal report?

    Friday, March 23, 2012 2:08 PM

Answers

  •  

    hi,

    u have u set the entity collection to the datasource of the crystal reports before assigning to viewer

    u can use setdatasource of each table using the following code. if billrpt is the Report Objects then u can use 

    billrpt.Database.Tables["Table1NameSpecifiedinCrystalReports"].SetDataSource(billing);
    billrpt.Database.Tables["Table2NameSpecifiedinCrystalReports"].SetDataSource(returnHeader);
    

    hope this will help u

    regards

    Chidambara Jagannathan

    Saturday, March 24, 2012 10:43 AM