views:

145

answers:

1

I use a report in 2 projects, so I need to migrate report to a WebService by following this : http://aspalliance.com/1883_Building_Reports_using_ASPNET_and_Crystal_Reports__Part_5__Creating_Reports_as_a_Web_Service.1 From the existing report, it was loaded by a ReportDocument

    protected void Page_Load(object sender, EventArgs e)
    {
        //.....
        //Load DataSet

        ReportDocument report = new ReportDocument();
        report.Load(path + "Analyse.rpt");

        report.Database.Tables["Vente"].SetDataSource(ds.Tables["Vente"]);
        report.Database.Tables["Facture"].SetDataSource(ds.Tables["Facture"]);
        report.Database.Tables["Gratuit"].SetDataSource(ds.Tables["Gratuit"]);
        report.Database.Tables["Rachat"].SetDataSource(ds.Tables["Rachat"]);

        report.SetParameterValue("AccOnly", accOnly);
        report.SetParameterValue("TotalRachat", totalRachat);

        DiskFileDestinationOptions fileoption = new DiskFileDestinationOptions();
        fileoption.DiskFileName = sFileName;

        ExportOptions option = report.ExportOptions;
        option.DestinationOptions = fileoption;
        option.ExportDestinationType = ExportDestinationType.DiskFile;
        option.ExportFormatType = ExportFormatType.PortableDocFormat;

        report.Export();

        Response.ClearContent();
        Response.ClearHeaders();
        Response.ContentType = "application/pdf";
        Response.WriteFile(sFileName);
        Response.Flush();
        Response.Close();
        File.Delete(sFileName);
     }

But to call it from a WebService, it is not working anyway. Impossible to Load a report with an url.

I try with a CrystalReportViever

 CrystalReportViewer1.ReportSource = "http://localhost/ReportService/AnalyseService.asmx";

but how to set the DataSource in this case ?

Thanks for your help.

A: 

Anybody has the solution ? :(

User.Anonymous