Verify Database on Report with Parameterised Data Command

I have built a report which I want to run for four different tables in our MySQL database. It seems silly to have to create four different versions of the report for four different tables, so I tried to utilise the 'Add command' function which allowed me to enter a SELECT statement with a parameter of the table name. This works absolutely fine, however, if I change the table name parameter, I need to run the 'Verify database' function in Crystal Reports for the data to be shown correctly.

However, the front end for our users is a C# application which has been written to pass the necessary parameters to each report. However, when selecting a table name parameter other than the one used when the report was last saved, I get an InternalException - 'One or more fields could not be found in the result set. Use Verify Database to update the report.', Is there a way to run this function in code from .NET? (I have tried ReportDocument.VerifyDatabase() but this doesn't seem to be for the same purpose as the one I mentioned previously in Crystal Reports).

We are using Crystal Reports 2008 SP3, connecting to a MySQL database via ODBC. The application is coded using Visual Studio 2008/.NET 3.5 using the C# language. All of the database connectivity attributes of the report are set in the report itself, not in .NET.

Thanks for your help!

Edited by: StevenDay on Nov 22, 2011 12:29 PM

  • SAP Moderator
  • SAP Employee
<body><p>There are a couple of things to note here; </p><p></p><p>1) Make sure you are working with SP4: </p><p>SP4 </p><p>SP4 MSI </p><p>SP4 MSM </p><p></p><p>2) If the tables are identical, the report should not need to verify the database - something you may want to have a closer look at. The message; &quot;One or more fields could not be found in the result set.&quot;, is a confirmation of this. E.g.; the field the report is expecting is not being found... </p><p></p><p>3) ReportDocument.VerifyDatabase() does exactly the same thing as Verify in the designer. Additionally, if you enable Verify in the designer and save the report, then the Verify will be performed at runtime as well </p><p></p><p>4) Consider using InProc RAS APIs and ReplaceConnection. See &#91;this| <b>[original link is broken]</b> <b>[original link is broken]</b>; blog on how to. </p><p></p><p></p><p></p><p>- Ludek</p></body>
0 View this answer in context