473,473 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Adding a parameter to an ASP.NET deployed report causes a LoginException

Hi, everyone! Long time no see!

I have a report developed in Crystal 9 that I have implemented in
ASP.NET. I am not using the Viewer, I am passing it to the screen as
a PDF.

Becasue the report directly connects to a database to collect it's
information, I have had to use the infamous security loop to get
information to each table in the system.

//crConnectionInfo.ServerName = @"<myserver>";
crConnectionInfo.ServerName = "OCSA";
crConnectionInfo.DatabaseName = "OCSA";
crConnectionInfo.UserID = "<myusername>";
crConnectionInfo.Password = "<mypassword>";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
//Do the stupid security dance
foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable in
crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}

//Do the more stupid subreport dance.
Sections crSections;
ReportObjects crReportObjects;
SubreportObject crSubreportObject;
crSections = crReportDocument.ReportDefinition.Sections;
ReportDocument subRepDoc = new ReportDocument();
foreach(Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
foreach (ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind == ReportObjectKind.SubreportObject)
{
crSubreportObject = (SubreportObject)crReportObject;
subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName);
crDatabase = subRepDoc.Database;
crTables = crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable
in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
}
}
}
This solved the first login exception no problem, and was a fairly
easy fix.

So, I have some reports that work. Then I got a report with a
parameter. No problem, I added this code:

//Pass in the parameter
ParameterValues parameterValues = new ParameterValues();
ParameterDiscreteValue parameterDiscreteValue = new
ParameterDiscreteValue();
string classText = orgRosterClassDDL.SelectedItem.Text.ToString().Sub string(4,orgRosterClassDDL.SelectedItem.Text.ToStr ing().Length-4);
parameterDiscreteValue.Value = classText;
ParameterFieldDefinitions parameterFieldDefinitions =
crReportDocument.DataDefinition.ParameterFields;
ParameterFieldDefinition parameterFieldDefinition =
parameterFieldDefinitions["Class"];
parameterValues = parameterFieldDefinition.CurrentValues;
parameterValues.Add(parameterDiscreteValue);
parameterFieldDefinition.ApplyCurrentValues(parame terValues);

And went about my way. BUT, this code, when added, causes another
login exception at the point of Export.

My question - the question that even Crystal Decisions Tech Support
can't solve - is

WHY?
Nov 17 '05 #1
0 892

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

Similar topics

0
by: vivek | last post by:
I'm trying to create a crystal report by dynamically passing the dataset to the rpt(using dataset.xsd) and save it as PDF format.While dynamically passing the dataset to the crystal report and saving...
0
by: shriram.k | last post by:
I'm trying to create a crystal report by dynamically passing the dataset to the rpt(using dataset.xsd) and save it as PDF format.While dynamically passing the dataset to the crystal report and saving...
1
by: Dalan | last post by:
I have attempted to resolve a problem regarding erroneous output using a Between And parameter on several Access 97 queries, but to no avail. The queries are used for report output and...
3
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box...
1
by: tigger | last post by:
hi i have a report which i wish to reference from within the program this is what i am currently using which is fine on my local computer. crystalReportViewer1.ReportSource = "C:\\\\Documents...
3
by: MIGUEL | last post by:
Hi all, I'm quite lost with how adding web references to a project creates proxy classes. I've developed a web service with two classes inside and that contains three references to three...
1
by: yoursteveis | last post by:
Dear all, I have created a main report (for monthly purchase summary) and a sub report (for monthly sales summary). I have linked main report with a parameter query (i.e. purchasesummary1) and...
5
by: ljungers | last post by:
Hi to all. I hope someone can provide me with a solution to my problem. I have a Inventory master table that is used to produce a report. Currently a form is used so that either part of the item...
8
by: DanicaDear | last post by:
I have something interesting...looking to see if anyone else has came across this. I have a query with parameter and and the query works beautifully every time. However, when I use the wizard...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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...

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.