I am generating a simple report based on a Parameter that I pass into the report. About every 5the to 6th , sometimes not but every 20th time that I generate the report the Parameters Dialogue Box pops up and prompts me for the parameter. This is clearly a bug. I have searched the Internet numerous times and can’t find even a reference that anyone else is having this same issue. Below is the class I am using to generate the report. Is there a problem with the code? Is there a way to turn the Parameters Dialogue Box off (Keep it from popping up)? Please help.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.Shared;
namespace AECES
{
public partial class CompRpt : Form
{
string SSN = "";
string crConn;
public CompRpt(string crConnIn, string SSNIn)
{
InitializeComponent();
SSN = SSNIn;
crConn = crConnIn;
}
private void CompRpt_Load(object sender, EventArg e)
{
Cursor.Current = Cursors.WaitCursor;
try
{
CompTaskReport cr = new CompTaskReport();
CrystalDecisions.Shared.ConnectionInfo crDbConnection = new CrystalDecisions.Shared.ConnectionInfo();
crDbConnection.DatabaseName = "MyDatabase";
crDbConnection.ServerName = crConn;
crDbConnection.IntegratedSecurity = false;
crDbConnection.UserID = "Mylogin";
crDbConnection.Password = "MyPassword";
CrystalDecisions.CrystalReports.Engine.Database crDatabase = cr.Database;
CrystalDecisions.Shared.TableLogOnInfo oCrTableLoginInfo;
foreach (CrystalDecisions.CrystalReports.Engine.Table oCrTable in crDatabase.Tables)
{
oCrTableLoginInfo = oCrTable.LogOnInfo;
oCrTableLoginInfo.ConnectionInfo = crDbConnection;
oCrTable.ApplyLogOnInfo(oCrTableLoginInfo);
}
crystalReportViewer1.ReportSource = cr;
ParameterField field1 = this.crystalReportViewer1.ParameterFieldInfo[0];
ParameterDiscreteValue val1 = new ParameterDiscreteValue();
val1.Value = SSN;
field1.CurrentValues.Add(val1);
}
finally
{
Cursor.Current = Cursors.Default;
}
}
}
}
I am using VS 2008 and Crystal Reports Basic
Thank you again for the help.