locked
Crystal Reports RRS feed

  • Question

  • User-1558584061 posted

    Using VS 2010 , Crystal Reports 13 :

    Aspx.cs:
    DataTable dTable = fnGetReportData(); // this functions fills up data according to parameters passed eg: data from date        //   "1 Dec 2011" to "15 Dec 2011" from a view
    ReportDocument rptDoc = new ReportDocument();
    rptDoc.Load(Server.MapPath("~/ReportName.rpt"));
    rptDoc.SetDatabaseLogon("username", "password", "server", "database");
    rptDoc .SetDataSource(dTable);
    CrystalReportViewer1.ReportSource = rptDoc ;

    .aspx page:
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
                EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" 
                HasCrystalLogo="False" ReuseParameterValuesOnRefresh="True" />

    But when I run it, crystal report displays whole of the data present in source view.

    Saturday, December 17, 2011 6:56 AM

Answers

  • User1759999623 posted

    It may be that whatever datasource is defined in the actual report is overriding the SetDataSource method.  Run this after commenting out your SetDataSource method call and see if you get the same result.  If so, then you will need to reconfigure your report to use an ADO.NET DataSet to make this work within your application.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 17, 2011 9:09 AM

All replies

  • User1759999623 posted

    It may be that whatever datasource is defined in the actual report is overriding the SetDataSource method.  Run this after commenting out your SetDataSource method call and see if you get the same result.  If so, then you will need to reconfigure your report to use an ADO.NET DataSet to make this work within your application.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 17, 2011 9:09 AM
  • User-1558584061 posted

    Yes you were right, when i commented setdatasource method it still worked and in the same way. Now i created a new report and its working finr. Cant figure out what happened.

    Can you suggest why or how the datasource overrides the setdatasource method?

    Thanks for the solution :D

    Monday, December 19, 2011 1:18 AM