0

Hello I'm planning an application that is basically a reporting front-end for a database (proprietary Pervasive SQL) using an ODBC dsn-less connection string.

I am able to create the dataset in Visual Studio and link up the report(s) to the app. However in real world usage, the location of the database will be different per user. That is not the main problem. I overcame that with the connection string that allows you to set the location of the database path.

Here's the kicker...

The name of the tables that I want to read from are prefixed with a unique filename (actually the same name I mentioned above). I need crystal to re-map the table names at runtime. Just the table name prefixes really. The fields and names of the fields will not change.

Any ideas on where I should look for writing this block? I am using VS2010 & C# if that helps. I think thee should be some sort of class files that come with Crystal that can do some runtime reflection to get/set the table names?

Any thoughts would be welcome and appreciated. Rob

Edit: I found some documents link that has API docs and other support. I will be studying them. They are all .chm files (Windows help files) so there is no "online" docs to search for.

1 Answer 1

0
  • Add a Crystal reportViewer change the name to objReport
  • add a public function ShowReport()

    public void ShowReport(ReportDocument objReport)
    {
        Cursor.Current = Cursors.WaitCursor;
        objReport.SetDatabaseLogon("", "dbpassword");
        cRep.ReportSource = objReport;
        this.Show();
        Cursor.Current = Cursors.Default;
    }
    

And Call it from anywhere in your application

ds = GetDataInDataSet();//fILL DataSet with your data
rptPSummary objRpt = new rptPSummary();
objRpt.SummaryInfo.ReportComments = "Have a nice day";
objRpt.SummaryInfo.ReportTitle = "Purchase Summary Report from " + sDate.ToString("dd/MM/yyyy") + " to " + eDate.ToString("dd/MM/yyyy");
objRpt.SetDataSource(ds);

frmReportView frmRpt = new frmReportView();
frmRpt.Text = objRpt.SummaryInfo.ReportTitle;
frmRpt.MdiParent = this;
frmRpt.ShowReport(objRpt);
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply! So it seems that the Dataset is what determines what the table names are? When you pass the Dataset to the report how does it know which table to query?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.