Crystal Report Viewer Failed to Open Connection - c#

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.

Related

(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. :)

C# ReportViewer Control Alternative

Good day,
I would like to know if anyone can suggest an alternative to Visual Studio's built in report Viewer control.
The simple reason being that we work with large amounts of data and the built in report Viewer can't hanndle the load (to be more specific we use reports which relies on close to 30 000 records). SQL Server Reporting Services (SSRS) is not an option since we use both Oracle and SQL Server Databases depending on the environment. We did implement a "batch run" solution to our current system where we only handle an x amount of records at a time but this solution doesn't work with the large amount of records we now use.
For more info we currently rely on rdlc files for your individual reports and based on which report needs to be generated the Database query is constructed and executed and the report viewer is then used to show the results. (The real problem is the ReportViewer Control it simply can't handle the sheer amount of data).
The alternative can be a free or pay to use solution.
Any help would be appreciated.
I can recommend Fast Report. I've worked with the VCL solution for years and if the .NET version is anything close, it's worth a try. You can download a trial version from their website afaik.

printing bill in the preprinted paper using crystal report

I am working on the desktop application which needs to print the bill.I am currently using Visual Studio 10 and sql express as database.
I need to print the bill in the pre printed paper which has majority of the content.
I just need to add the customer name, some customer details and content of the bill which is saved in the database.
The pre printed bill has logo along with some basic information of the company....
so i need to fill the bill with name and search the data using stored procedure.
i will be grateful if anyone helped me in any way possible
Try scanning the hard copy paper into an image file, and setting that image file as the background on the report.
From there, just put a couple of the fields onto the report where it looks like they should go. Remove/hide the background and print a test page to find the offset. It should be pretty evident if the fields are generally a centimeter higher on the page than they should be. Then just adjust the fields accordingly.
I know it seems like a daunting task at first, but after the first one or two reports you will get the hang of it.
[Edit]
In the report itself, hide the header and footer and set the detail height to 7.5 (or whatever the full page height is, taking into account margins). Pass the report exactly one record with the values that need to be printed.
You may also consider using SQL Server Reporting Services (SSRS) instead of Crystal Reports. Crystal can be tricky to deploy with desktop applications. SSRS Express is free. You will just need to install SQL Server Express with Advanced Services.

Reporting tool which print the control which we pass on that

What is the best reporting tool other than crystal report using with c# and mysql because crystal report has to be downloaded in user machine ? So what is the other alternative of the crystal report for using c# with mysql and should be less in size and user will not have to need to download more.And it should be with good features. (All open source and with paying charge.)
EDIT: I have need of printing only control on the form dynamically, like if user want to print third party control then also it should be printed, but it should not be printed like image of the treeview like if user wants to print the treeview on the window form but treeview is collapsed by user so here if user prints this treeview then it should not be printed collapsed treeview and but it should be printed whole the treeview(expanded).
Not a reporting tool at all, but if you're most interested with simply having a PDF output I recommend iTextSharp. You can then fill the report with place holders to be replaced with variables as you would any software - prior to the user downloading it.
Not the best method I agree, but it all depends on what you're looking for.
Two options for you to use
SQL Reporting Services - this has a requirement that you install a Microsoft SQL server with SRS but your reports themselves can connect to other databases, including MySQL (via ODBC) and you can then use the ReportViewer component in your C# applications to render it. There is no additional downloads for the user as the processing happens server side, plus it is easy to embed into web apps, SharePoint etc...
Visual Studio 2010 does ship with fantastic reporting controls which can use any data source. If you on 2008 you can use the out of band release of these same controls. In all cases these are just code so it's a few extra assemblies to deploy. You can see samples of these in: http://code.msdn.microsoft.com/mschart

Crystal Report VerifyDatabase not working

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.

Categories