Hello,
I have a single report that I created from scratch.
It is a very simple one that retrieves data from a SQL connection.
It has 2 subreports inside and it has 3 parameters.
I have an environment with Crystal Server 2013 OEM.
I am using unmanaged RAS to display the report mentioned above using 2 different tools: an ASPX forms and a Windows forms application.
The code for both tools provide all that is necessary for the report to run without the user having to type anything.
The windows forms version works without a hitch. However, the ASPX form always asks for the parameters, even though they should be automatically assigned by the code.
The code is fairly similar for both versions, with some minor differences.
Does anybody know why would this happen?
Thank you in advance,
Hector
The code that displays the report in the windows form is the following:
ReportAppSession reportSession = new ReportAppSession();
reportSession.ReportAppServer = "RAS_SERVER_NAME";
reportSession.Initialize();
// Create the report document
ReportClientDocument clientDocument = new ReportClientDocument();
clientDocument.ReportAppServer = "RAS_SERVER_NAME";
object filepath = @"rassdk://C:\\Report.rpt";
clientDocument.Open(filepath, 1);
this.ParametersLoad(ref clientDocument);
crystalReportViewer1.ReportSource = clientDocument;
// Set DB Connection
CrystalDecisions.Shared.ConnectionInfo connectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
TableLogOnInfos logOnInfos = crystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo logOnInfo in logOnInfos)
{
logOnInfo.ConnectionInfo = connectionInfo;
}
connectionInfo.DatabaseName = "DB_NAME";
connectionInfo.UserID = "USER";
connectionInfo.Password = "PASSWORD";
The parameters are assigned with this method:
private void ParametersLoad(ref ReportClientDocument currentReport)
{
if (currentReport.DataDefinition.ParameterFields.Count > 0)
{
CrystalDecisions.ReportAppServer.DataDefModel.ParameterField tempParam;
CrystalDecisions.ReportAppServer.Controllers.ParameterFieldController paramController;
CrystalDecisions.ReportAppServer.DataDefModel.ParameterFieldDiscreteValue discreteVal;
string sFieldName;
string sValue;
int paramNum = 1;
foreach (CrystalDecisions.ReportAppServer.DataDefModel.ParameterField paramField in currentReport.DataDefinition.ParameterFields)
{
sValue = "";
tempParam = new CrystalDecisions.ReportAppServer.DataDefModel.ParameterField();
paramField.CopyTo(tempParam, true);
sFieldName = paramField.Name;
switch (sFieldName)
{
default:
sValue = "Parameter #" + paramNum.ToString();
break;
}
discreteVal = new CrystalDecisions.ReportAppServer.DataDefModel.ParameterFieldDiscreteValue();
if (sValue.Trim() != "")
discreteVal.Value = sValue;
else
discreteVal.Value = "";
tempParam.CurrentValues.Add(discreteVal);
paramController = currentReport.DataDefController.ParameterFieldController;
paramController.Modify(paramField, tempParam);
paramNum++;
}
}