473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 SetDBLogonForRe port(Connection Info connectionInfo,
ReportDocument reportDocument)
{
Tables tables = reportDocument. Database.Tables ;
foreach (CrystalDecisio ns.CrystalRepor ts.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo ;
tableLogonInfo. ConnectionInfo = connectionInfo;
table.ApplyLogO nInfo(tableLogo nInfo);
}
}
private void SetDBLogonForSu breports(Connec tionInfo connectionInfo,
ReportDocument reportDocument)
{
Sections sections = reportDocument. ReportDefinitio n.Sections;
foreach (Section section in sections)
{
ReportObjects reportObjects = section.ReportO bjects;
foreach (ReportObject reportObject in reportObjects)
{
if (reportObject.K ind == ReportObjectKin d.SubreportObje ct)
{
SubreportObject subreportObject =
(SubreportObjec t)reportObject;
ReportDocument subReportDocume nt =
subreportObject .OpenSubreport( subreportObject .SubreportName) ;
SetDBLogonForRe port(connection Info, subReportDocume nt);
}
}
}
}
private void GenerateInspect ionReport()
{
ReportDocument O_Report = new ReportDocument( );
string strReportPath = Request.Physica lApplicationPat h +
"\\InspectionRe port.rpt";
string strPDF_Path = MyPath + "\\";
O_Report.Load(s trReportPath);
ConnectionInfo connectionInfo = new ConnectionInfo( );
connectionInfo. ServerName = "civicview" ;
connectionInfo. DatabaseName = "civicview" ;
connectionInfo. UserID = "_SYSTEM";
connectionInfo. Password = "SYS";
SetDBLogonForRe port(connection Info, O_Report);
SetDBLogonForSu breports(connec tionInfo, O_Report);
ParameterValues currentParamete rValues = new ParameterValues ();
ParameterDiscre teValue parameterDiscre teValue = new
ParameterDiscre teValue();
parameterDiscre teValue.Value = "275";
currentParamete rValues.Add(par ameterDiscreteV alue);
ParameterFieldD efinitions parameterFieldD efinitions =
O_Report.DataDe finition.Parame terFields;
ParameterFieldD efinition parameterFieldD efinition =
parameterFieldD efinitions["Evaluation ID"];
parameterFieldD efinition.Apply CurrentValues(c urrentParameter Values);
O_Report.Export ToDisk(ExportFo rmatType.Portab leDocFormat,
strPDF_Path + "InspectionRepo rt.pdf");
O_Report.Close( );
O_Report.Dispos e();

}
Thanks
May 13 '07 #1
0 963

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

Similar topics

0
1691
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, or in the code) works fine. However, when I try to add any parameter through the record selection formula and/or the report parameters method,...
3
3048
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. Then I click on SET LOCATION. When the list comes up, I already have the same dataset as the "CURRENT DATASET" and I have the same dataset in the...
1
4646
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 crConnectionInfo.ServerName = "servername" crConnectionInfo.DatabaseName = "dbname"
0
1731
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. Situation: User can select anyone of these databases and the Report should work fine I am using following connection strings to connect with databases
3
3782
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 why is the bloody thing doing this. The paths have been checked and are correct. The crystal Report is a .rpt file. Not one created in the VS.net...
1
3261
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 system prompts them to login (User name and Password). If they view it in PDF format they do not get the login prompt. I do not get the login prompt at...
1
13956
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 prompts you for any necessary login information. My goal was to provide the login information by means of code, so that the user is not prompted for...
0
1714
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, or in the code) works fine. However, when I try to add any parameter through the record selection formula and/or the report parameters method,...
19
4360
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 thought it might have to do with the regristration key, but that ok, when I right click on Servers in the server explorer and then expand the...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.