Crystal Report VerifyDatabase not working - c#

I have a Crystal Report that was designed against a dev database. When I load it into the live system I need it to run a different but equivalent database. Normally I just run reports through some code in C# that sets the connection info, parameters and calls VerifyDatabase on the report and subreports and it all works well.
In one particular report this doesn't work though and doesn't seem to verify anything and the report crashes with an error 'The field name is not known' in one of the sub reports. With this report if I manually verify it in the Crystal Reports application against the live database then it all works fine.
So the question is, is there anything different that Verify Database function in the Crystal application does that I should do in code other than set connection info, parameters and call VerifyDatabase method?
Edit: Some more info on what I tried
Get a backup of the live database and put it on our dev environment.
Manually verify the report against this database (which is exactly the same structure as live)
Load the report into the live system and run it.
Error still occurs.

The 'field name is not known' error usually means that you have placed a field on the report or used it in a formula (etc), but the field no longer exists in the database. As I understand it, calling VerifyDatabase can update the field list for the views/tables in the report, and can remove fields from the report if they no longer exist, but it cannot fix formulas or subreport links which depend on a missing field.
It seems to me a better practice to make sure that the database is in sync (verified) before deploying the report so you don't need to call VerifyDatabase every time.
All that said, I don't see why it would work after manually verifying, but not after calling VerifyDatabase. Sometimes Crystal is weird that way. You might try recreating the subreport (if it is simple), or removing it and rebinding it to try to trick the error into going away.

It sounds like a confusion between two versions of Crystal and their capabilities. The version that comes with dotNET 2008 is Crystal Reports Basic for VS2008, masquerading as Crystal 10.5 (which doesn't exist as a standalone product). But if you're referring to standalone reports developed by themselves outside of the Visual Studio IDE, then this will be a different version of Crystal with some differences in capability. I'd say this report was created in a different version of Crystal to the others, and that the Verify within the code is coming across some feature that 10.5 can't recognise.
If you have a standalone version of Crystal (which will need to be either Crystal Reports 2008, or a Developer edition of an earlier version), use this to make sure you're using the same Crystal version in the app as in in report development.

Could you verify this:
While the debugger is running, if the schema in a typed dataset is changed and you run Verify Database the messagebox always displays "Database up to date" even though there is a difference in the two schemas.
This took me a while to figure out because the Verify Database action was not disabled when the debugger was active.

Related

Crystal reports for .net prompting login information everytime

Im using a Dataset class .xsd file which contains schema for 2 tables. This is a part of a dll which I am adding as a reference to my project. Iam able to use all the methods from the referenced dll.
While designing the crystal report, for the Datasource, by default this dataset is prompted and I am able to see both the tables under it and from the field explorer i have used the columns from the tables.
I am filling in data into those two tables during runtime before calling the report. It works perfectly fine.
BUT, when I move my code from one server environment to another, the database login information is prompted everytime I load the report.
Im not using any table from the database. I don't understand how to make crystal report 'see' the datasource.
I have gone through most help links that talk about this problem, but not one seem to have my kind of environment. Please advise. Thanks in advance

(Change Datasource) Prompt for Server and SQL Server database within Crystal Reports Viewer, Visual Studio (C#)

I'm using SAP Crystal Reports 2016 with the Visual Studio plugin, along with Visual Studio 2015.
What I've done is created a simple MDI application using C# which contains multiple Crystal Reports Viewer forms which open an embedded report in a child window when the menu item is clicked. This application will sit on our development server and be used to run reports against client databases that get sent to us with problems.
Here's the issue. We've got multiple instances (and versions) of SQL Server running and we are getting multiple test databases daily which of course will be named differently. The reports are looking for a specific database only.
What I would like to do, is either on form load or via a button click, be able to have a box prompt the user for server and database name. For example:
SQLServer\SuperCoolInstance
My_Cool_Database
The report would then connect to that database and display relevant information.
Any idea on how I could accomplish this? Second best scenario would be to have something like an XML file that contains the server and database and the program looks at that when launching. Even though we'd have to edit the XML whenever we wanted to change datasources it would be something! I wouldn't know how to pursue that avenue either though.
I would think that this must be possible because at a previous company that I worked for, they actually sent compiled Crystal Reports (in exe format) to clients to run on THEIR systems and it looked to an already existing XML file.
Thanks very much in advance for any ideas or guidance.
Cheers.
EDIT - I thought I should point out that all the SQL Server databases that this would run on would have identical schema but different data obviously. Not that this probably matters for this particular question, but just in case. :)

Crystal Report Viewer Failed to Open Connection

I am attempting to create a simple Crystal Reports Viewer so we can view already built reports on multiple machines without needing crystal installed.
We are using Sage 100 Contractor which utilizes the .dbf format for its database.
I understand the basics of loading a report in the viewer, however the issues I am running into come from the fact that the data isn't always embedded in the reports. For certain ones I need to allow the users to select the database to run the report off of.
Example database location
C:\MB7\Sample Company
I have tried multiple different things, but I am sadly just not correctly understanding how to properly set the DataSource location before I load the report in the crystalReportViewer module.
I can give snip-its of my code, but that won't really show anything as nothing I've tried has correctly set the DataSource.
My guess is that your code didn't succeed to set the database connection. Are you able to run the report on your development machine ? If yes then, the problem is related to the ODBC DSN on the other machines. If you are not able to run it even on your machine then check if you are able to run the report form the designer. It will help if you share the code, which is setting the connection.
There are cheap tools on the market , which will be able to do what you are looking for a fraction of the development price. Here is a link to a tool , which you can use for free:
http://www.r-tag.com/Pages/FreeCrystalReportsViewer.aspx
Even if you decide to continue with the development of your tool you can check if the one above is able to handle the report. This will be an easy way to find if the problem is in your code or it is related to the DSN.

C# and Crystal Reports SDK - Selection Criteria Ignored

I have a crystal reports rpt file being called from C# code. Report works as expected from Designer within Studio 2010. Same report ignores Selection Criteria when called from C#, but ONLY when including a certain table's field in the criteria.
Current Criteria Example :
date({transaction.transaction_date}) in {?FromTo} and
{user_branch.branch_id} = 1
{?FromTo} is a date range parameter which works perfectly
When I remove the branch_id section, the {?FromTo} date parameter is checked correctly and the data returns as expected. BUT, as soon as I include the branch_id field, ALL the data is returned, which does not make sense at all.
Running this exact same report via the designer, works correctly... The problem occurs when running via C# SDK code.
Any help with this will be GREATLY appreciated
Already Tried
Recreate Entire Report from Scratch bit by bit, table by table. This works up to a point where I start adding more fields to the report itself, no one in particular, then the problem starts up again... So obviously, I start back tracing my steps until the entire report is empty again, but the problem persists, like the file is now "broken"
No similar issues in google... No where in my code is a line emptying the selection criteria during code... My other reports not accessing that table works fine.
Currently using version 13.0.1 of the CR Runtime. Tried to upgrade to 13.0.2, still didn't work
Ran the exact same SQL that the report generated directly against the database. That works as expected.
Try changing your criteria to:
(date({transaction.transaction_date}) in {?FromTo}) and
{user_branch.branch_id} = 1
Adding the date({transaction.transaction_date}) in {?FromTo} line inside a (). I'm not just sure.
After many head-aches this week, I finally found the problem... This looks like a bug in the SDK itself though, but to solve the problem, just make sure that the field giving the problem mentioned above is contained in the detail section of the report.
i.e. I added my branch_id field to the detail section of the report and suppressed it. It works by suppressing the section as well, just as long as the field is contained there.
I tested this on all my other reports with the same problem and it worked.

Reporting services and errors in expressions

I'm researching using Microsoft Reporting Services as a replacement for Crystal Reports. In production, most of the reports would be built by technical end-users, or by professional report designers (people who are technical, but not developers)
My question:
I've created a report, and I have purposely put a syntax error in an expression to see what the user experience is (I'm using the report designer in VS2010).
When I build, I get a compile error. If I double-click the error, VS just takes me to the .RDLC file. It doesn't even take me to the line that has the error, and the message is very ambiguous. Am I missing something, or is this the design experience?
I have found it to be very annoying not being able to double click on the error and be taken to the error on the report. It seems like it is the design experience.
However the description of the of the error does tell you the name of the field in the report that has the error and little bit about the error.
Example, textbox1 is the field that had the error:
The Value expression for the textbox
‘textbox1’ contains an error:
[BC30451] Name 'Fieldsbus' is not
declared.
Have you looked at the Report Builder for SQL Server? It is a stand alone application that you can create reports with. It is meant to be used by Report Designers and other technical users. It is also meant to be used with a SQL Server Report Server. You can run reports without "compiling".
Does crystal reports have better error messages?

Categories