Hello everyone,
I know this is an old topic and I have read many other forum posts across the web about this topic but I have not found a solution. I have a crystal report that is given parameters from my visual studio 2013 program. SOMETIMES, this crystal report asks for parameters using the crystal parameter prompt even though I have passed it parameters. Needless to say this is annoying.
I have downloaded CRforVS_13_0_15.exe and all my assembly/.dll file versions reflect this. I am using .NET Framework 4.
Following please find the code used to generate the report:
public void generateRpt(string stkid, int partFlag)
{
crystalReportViewer1.Enabled = true;
ReportDocument crystalReport = new ReportDocument();
string path = System.IO.Directory.GetCurrentDirectory();
crystalReport.Load(path + "/FG_Reciept.rpt");
crystalReportViewer1.ReportSource = crystalReport;
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "packall-cluster";
connectionInfo.DatabaseName = "PAPROD";
connectionInfo.UserID = "xpackall";
connectionInfo.Password = "pa7745";
setDBLogOn(connectionInfo);
crystalReport.SetParameterValue("m_stockid", stkid);
crystalReport.SetParameterValue("m_partflag", partFlag);
}
private void setDBLogOn(ConnectionInfo myconnectioninfo)
{
TableLogOnInfos mytableloginfos = new TableLogOnInfos();
mytableloginfos = crystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
{
myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
}
}
Any help would be appreciated. Thank you!