SetParameterValue Not passing parameters to the SP
-
HI friends, this question is regarding Crystal Reports in VS 2005 My report here is attached to a SP. I'm trying to pass parameters but it raises an error: Procedure or function 'sp_wfsAppByCounsReport' expects parameter '@StartingDate', which was not supplied. Here is my code, I'm passing the parameter. I can even trace it and the rdDocument variable has them attached after the SetParameteValue....why the report is not sending them to the SP??? Here is my code:
protected void Page\_Load(object sender, EventArgs e) { DateTime dtStartingDate = DateTime.Parse(DateTime.Today.Month.ToString() + "/" + "1" + "/" + DateTime.Today.Year.ToString()); ConnectionInfo ciLogin = new ConnectionInfo(); ciLogin.ServerName = "myserver.com"; ciLogin.DatabaseName = "mydb"; ciLogin.UserID = "dbuser"; ciLogin.Password = "mypass"; TableLogOnInfo tbLogonTable = new TableLogOnInfo(); tbLogonTable.ConnectionInfo = ciLogin; ReportDocument rdMonthReport = new ReportDocument(); rdMonthReport.Load(Server.MapPath("couns-month.rpt")); rdMonthReport.SetParameterValue("@StartingDate", dtStartingDate); rdMonthReport.SetParameterValue("@EndingDate", DateTime.Today); foreach (CrystalDecisions.CrystalReports.Engine.Table tbTable in rdMonthReport.Database.Tables) { tbTable.ApplyLogOnInfo(tbLogonTable); } CrystalReportViewer.ReportSource = rdMonthReport; CrystalReportViewer.RefreshReport(); }
Any help is appreciated!!
-
HI friends, this question is regarding Crystal Reports in VS 2005 My report here is attached to a SP. I'm trying to pass parameters but it raises an error: Procedure or function 'sp_wfsAppByCounsReport' expects parameter '@StartingDate', which was not supplied. Here is my code, I'm passing the parameter. I can even trace it and the rdDocument variable has them attached after the SetParameteValue....why the report is not sending them to the SP??? Here is my code:
protected void Page\_Load(object sender, EventArgs e) { DateTime dtStartingDate = DateTime.Parse(DateTime.Today.Month.ToString() + "/" + "1" + "/" + DateTime.Today.Year.ToString()); ConnectionInfo ciLogin = new ConnectionInfo(); ciLogin.ServerName = "myserver.com"; ciLogin.DatabaseName = "mydb"; ciLogin.UserID = "dbuser"; ciLogin.Password = "mypass"; TableLogOnInfo tbLogonTable = new TableLogOnInfo(); tbLogonTable.ConnectionInfo = ciLogin; ReportDocument rdMonthReport = new ReportDocument(); rdMonthReport.Load(Server.MapPath("couns-month.rpt")); rdMonthReport.SetParameterValue("@StartingDate", dtStartingDate); rdMonthReport.SetParameterValue("@EndingDate", DateTime.Today); foreach (CrystalDecisions.CrystalReports.Engine.Table tbTable in rdMonthReport.Database.Tables) { tbTable.ApplyLogOnInfo(tbLogonTable); } CrystalReportViewer.ReportSource = rdMonthReport; CrystalReportViewer.RefreshReport(); }
Any help is appreciated!!
Is your date format correct ? Is MM/DD/YYYY what your server expects ? any need to write code that works out hte local format and uses it ?
Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.
-
Is your date format correct ? Is MM/DD/YYYY what your server expects ? any need to write code that works out hte local format and uses it ?
Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.