473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Crystal report login Failure

Hi,

I'm using this code to run a crystal report and export it to pdf, and when
running it it in debug mode it working fine, but from the browser it's fails
to run telling me that the Crystal report failed to Login!!?

private void SetDBLogonForReport(ConnectionInfo connectionInfo,
ReportDocument reportDocument)
{
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
}
private void SetDBLogonForSubreports(ConnectionInfo connectionInfo,
ReportDocument reportDocument)
{
Sections sections = reportDocument.ReportDefinition.Sections;
foreach (Section section in sections)
{
ReportObjects reportObjects = section.ReportObjects;
foreach (ReportObject reportObject in reportObjects)
{
if (reportObject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject subreportObject =
(SubreportObject)reportObject;
ReportDocument subReportDocument =
subreportObject.OpenSubreport(subreportObject.Subr eportName);
SetDBLogonForReport(connectionInfo, subReportDocument);
}
}
}
}
private void GenerateInspectionReport()
{
ReportDocument O_Report = new ReportDocument();
string strReportPath = Request.PhysicalApplicationPath +
"\\InspectionReport.rpt";
string strPDF_Path = MyPath + "\\";
O_Report.Load(strReportPath);
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "civicview";
connectionInfo.DatabaseName = "civicview";
connectionInfo.UserID = "_SYSTEM";
connectionInfo.Password = "SYS";
SetDBLogonForReport(connectionInfo, O_Report);
SetDBLogonForSubreports(connectionInfo, O_Report);
ParameterValues currentParameterValues = new ParameterValues();
ParameterDiscreteValue parameterDiscreteValue = new
ParameterDiscreteValue();
parameterDiscreteValue.Value = "275";
currentParameterValues.Add(parameterDiscreteValue) ;
ParameterFieldDefinitions parameterFieldDefinitions =
O_Report.DataDefinition.ParameterFields;
ParameterFieldDefinition parameterFieldDefinition =
parameterFieldDefinitions["EvaluationID"];
parameterFieldDefinition.ApplyCurrentValues(curren tParameterValues);
O_Report.ExportToDisk(ExportFormatType.PortableDoc Format,
strPDF_Path + "InspectionReport.pdf");
O_Report.Close();
O_Report.Dispose();

}
Thanks
May 13 '07 #1
0 954

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Jones | last post by:
Hey all, I am trying to try get a crytal report running properly. A "Hello World" report that does not add criteria to the record selection formula of the report (either in the development tool,...
3
by: Michelle Stone | last post by:
Thanks for your message I tried again and again... but didn't work. Can u please detail the exact steps to perform? This is what I do. In field explorer, i right-click the dataset to update....
1
by: codepuller | last post by:
Consider this approach: Embed the report in your project (add it to the project) Then put this code in the page that holds the viewer control 'Set the connection information...
0
by: Atif | last post by:
Hi All My problem is not related with this group BUT i have got a clue from here that's why i am posting this question over here. I am using Crystal Reports 9 with MySQL and SQL Server....
3
by: Deasun | last post by:
I need some help please! Crystal is driving me nuts. Heres my code so far, see below. Problem: On the .export() line it comes back with error #5 Login failed! I know the login info is good so...
1
by: CBKowitz | last post by:
I have an intermittent problem, when viewing a crystal report. This problem only happens to some users and some report formats. When they try to view the report in Microsoft Word format the...
1
by: Harshil | last post by:
Hi All, I am working on Vb.net application with oracle as my database. I have developed reports using crystal report 9. Usually when you open reports directly in crystal report viewer control it...
0
by: Timmy Jones | last post by:
Hey all, I am trying to try get a crytal report running properly. A "Hello World" report that does not add criteria to the record selection formula of the report (either in the development tool,...
19
by: Michael O'Donnell | last post by:
Hi All Am having major problem with crystal reports...Have designed my report no problem, its when I try to run and display ther report that I am getting a "Login Failed" message. At first I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.