Skip to Content

CrystalReports 2008 and .NET C# 2008 manipulate SQL on Runtime

Hello,

I need to manipulate the SQL at runtime. We have some Statistics, that have to be manipulated by search criteria filled in our application.

So I have to set these criteria at runtime.

I earlier versions of CrystalReports we used the RDC and to get the SQL by the sqlquerystring property,

manipulate the SQL and set it again.

What can be done in CrystalReports 2008 with C# .NET?

Regards Christian.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Sep 03, 2008 at 01:59 PM

    There is no way to pass an actual SQL Query to the report - not since version 9 of Crystal Reports and certainly not with the Crystal reports .NET SDK. However you could create a dataset and pass that to the report. Essentially the line of code that passes the dataset would be:

    explicitly

    crReportDocument.Database.Tables(0).SetDataSource(dataSet.Tables("NAME_OF_TABLE"))

    or implicitly

    crReportDocument.SetDataSource(dataSet) or crReportDocument.SetDataSource(dataSe.Tables(0))

    See the following for more information:

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2091d0c3-da1d-2b10-22be-a3426b183f75

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/401c4455-a31d-2b10-ae96-fa57af5aec20

    Ludek

    Add comment
    10|10000 characters needed characters exceeded