Crystal Reports for VS2010 - c#

I'm having some issues getting crystal reports working nicely with our applications. And i cannot seem to find any resources that answer my question.
Basically, we have a crystal report, designed in the crystal reports application with it's own datasource.
Now when i add this to VS and display it, i need to setup a connection on the PC using MYSQL ODBC Datasource configuration tool, however even with this datasource setup, the crystalreports viewer askes for a password, and even suppling the correct password will show a "login failed. please try again" error message.
Ideally what i would like to know, is
A) is it possible and if so how, can i setup the connection in VS2010 so that i wont need to go around using MYSQL ODBC Datasource configuration tool on every PC i deploy my application too.
B) why does this connection always fail, the credentials are correct (we've tested multiple times, and the report & connection function perfectly from within crystal reports)
Hopefully you guys can help me out, my google fu has failed me.

If the Crystal Report allows for the username and password to the mySQL stored procedure to be passed to the report through the ReportViewer object, you have to use .NET code-behind to set the credentials via the:
ReportViewer.ServerReport.ReportServerCredentials
property of the ReportViewer instance.
Here's an example:
System.Net.NetworkCredential networkCredentials =
new System.Net.NetworkCredential("username", "password", "domain");
reportViewer.ServerReport.ReportServerCredentials = networkCredentials;

Related

Crystal Report generates on dev box, but not web server

I have a CrystalReportViewer control on an ASPX page. On my development machine the Crystal Report generates properly. However, when I publish it and run it on a web server I get the following pop-up screen. Entering in the password does nothing. The same screen just pops up again:
The datasource is configured in the .rpt file. So my code on the CrystalReportViewer is simply the following:
if (Request.QueryString["report"].ToString() != "")
{
ReportDocument doc = new ReportDocument();
doc.Load(Request.QueryString["report"].ToString());
CrystalReportViewer1.ReportSource = doc;
}
If it helps, some of the (more important looking) datasource properties in the .rpt file are as follows:
Database Type: ODBC (RDO)
DSN: plmprod
Server Type: ODBC - plmprod
Use DSN Default Properties: True
Also, I have the same ODBC/System DSN (named plmprod) setup on my development machine and on the web server. Using the "Test Connection" option they both test successfully.
I am not sure how to troubleshoot this issue. Nor do I know much about Crystal Reports.
What could be the problem that is causing the report to not generate on the web server?
I created a 64 bit ODBC/DSN on the web server and it now works!
All of my Crystal Reports Windows apps work fine around the company with 32 bit DSNs so I made a false assumption that is what the web server would want as well...not so as I found out.

Permission error when setting SSRS report parameters in C#

experts,
I'm inheriting a C# script to render a SSRS report. The script throws the following exception when it tries to set the report parameters ( serverReport.SetParameters(parameters): )
Microsoft.Reporting.WinForms.ReportServerException: The permissions granted to user 'domainName\userName' are insufficient for performing this operation.
However, I am able to execute the report on the report manager without any problems. For Datasource setup, I selected "Credentials stored securely in the report server", filled in the above username (domainName\userName) and the password fields, and checked the box "Use as Windows credentials when connecting to the data source". The report runs successfully on the report server.
Additonal info: The processing mode for the report viewer is set to remote in the C# script (reportViewer.ProcessingMode = ProcessingMode.Remote).
I don't understand why the credential works when executing the report on the report server, but not when accessing it through the C# script. I'm very new to C# and any help and info will be greatly appreciated.
Thanks in advance.
Problem solved.
It turned out that additional permission is needed for the report on the report server. After the DBA granted the account access to the report folder, the problem is solved.

Telerik ReportViewer Q2 2014

I am trying to learn how to use the Telerik Reporting dll and i cannot find a single solid example that explains setup from start to finish for wanting to render a report that is located on an ssrs server. I am trying to set it up just like the normal windows reportviewer control( i know they're not the same). I have researched trying to set the server, report path, credentials, and so forth to simply connect and find the report to render but there is not one damn example...Can someone please share the secret to get this method working? The below code worked perfectly with the windows reportviewer control but i can't find an example for the telerik one that comes close to these properties for setup.
ServerReport serverReport = rvMain.ServerReport;
//User Credentials
System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;
ReportServerCredentials rptServerCrecentials = serverReport.ReportServerCredentials;
rptServerCrecentials.NetworkCredentials = credentials;
serverReport.ReportServerUrl = new Uri(report.ReportServer);
serverReport.ReportPath = report.ReportPath;
//EnableExportFormats(report.ExportTypes);
//Render the report
rvMain.RefreshReport();
Telerik Reporting does not support opening SSRS reports - this is the reason why you are having troubles. It can only open reports created with the Telerik report designers.
Cheers.

No Printers are installed issue with crystal report PrintToPrinter

I had recently upgraded the Crystal report runtime version from 13.0.1 to 13.0.8 to use the new feature of HTML interpretation of text.
I have the logic of printing crystal report as part of a WCF Service.
But we are now facing issues while we try to Print the report directly on a network printer using report.PrintToPrinter method saying printer not installed even though it was still installed and working.
when i tried to execute report.ExportToDisk method its sucesfully exporting it as a pdf file on to hard drive with new version 13.0.8
But when rolled back to an older version on CR runtime it started working fine.
Any clues on wat exactly could have caused the issue?
Thanks
In the application pool, set
Process Model Load User Profile: True
To avoid having the domain account or the user that setup the printers logged in.
I had a similar problem where a call to PrintToPrinter was working in development but failing in other environments. After tremendous heartache, I discovered that changing the PrintToPrinter call solved the problem. Hopefully this info will help others in the future.
This post from SAP forums lead me in the right direction:
https://answers.sap.com/questions/12380707/no-printers-are-installed---printtoprinter-problem.html
Changing from this:
crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";
crystalReport.PrintToPrinter(1, true, 0, 0);
to this:
System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings();
printersettings.PrinterName = PrinterToUse;
printersettings.Copies = 1;
printersettings.Collate = false;
Report.PrintToPrinter(printersettings, new System.Drawing.Printing.PageSettings(), false);

Crystal report - Running thru .NET

I created a crystal report using test a DB. I run the report using .NET ReportDocument class. Everything works fine until I connect to the test DB.
When same report is pointed to UAT DB (all required DB objects are available in UAT too), I am getting error. To fix this, I have to change the server name to UAT DB manually in the RPT file.
How to fix this?
A solution is to create a system DSN (ODBC) for connecting to your target database. You can then switch the ODBC to whichever database you want (local,test,stage etc). Also, if you ensure an ODBC connection of the same name is available on all your servers, moving the report from dev->test->stage->production should be easy.
Using push reports should solve your issue. You can set up the report to accept a strongly-typed ADO.NET Dataset, and supply that dataset at runtime.
Isn't that how it's supposed to work? It has to know to what DB it's connecting?
Maybe I'm missing something but it sounds like you just needed to get the connection right.

Categories