PC Review


Reply
Thread Tools Rate Thread

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

 
 
Bill Sempf
Guest
Posts: n/a
 
      22nd Aug 2003
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.Table 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.Table 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().Substring(4,orgRosterClassDDL.SelectedItem.Text.ToString().Length-4);
parameterDiscreteValue.Value = classText;
ParameterFieldDefinitions parameterFieldDefinitions =
crReportDocument.DataDefinition.ParameterFields;
ParameterFieldDefinition parameterFieldDefinition =
parameterFieldDefinitions["Class"];
parameterValues = parameterFieldDefinition.CurrentValues;
parameterValues.Add(parameterDiscreteValue);
parameterFieldDefinition.ApplyCurrentValues(parameterValues);

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?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding components to deployed system [JULO] Windows XP Embedded 2 29th Mar 2008 12:14 PM
Adding a chart to a report with a parameter query =?Utf-8?B?SmltQUE=?= Microsoft Access Reports 5 28th Sep 2006 10:34 PM
Report Headers - adding values from a parameter query =?Utf-8?B?QyBNYXJrb3dpdHo=?= Microsoft Access Reports 3 3rd Dec 2004 06:55 PM
RE: crystal report shows empty report on deployed machine. =?Utf-8?B?aWxrZXI=?= Microsoft VB .NET 0 28th Jul 2004 07:20 AM
Adding hardware after image is deployed Bgreaves Windows XP Embedded 1 12th Nov 2003 08:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:11 AM.