Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass date parameter

Status
Not open for further replies.

suntanme

Programmer
Jul 20, 2002
16
US
I am trying to pass a date parameter to Crystal Reports 8.0 from VC. It works great for strings and numbers but crashes on dates. I assuming that my syntax is incorrect. Does anyone have a suggestion? Thanks in advance.


m_Report->ParameterFields->GetItem(1)->SetCurrentValue((_bstr_t)"@TheDateParameter;& Date(2000,01,01) &;
 
Found the solution ... you can't send parameter dates when using RDC. They have to passed as formulas.
 
I am having trouble passing a date parameter to a web report using J#. Here are the details:
-Displaying a Crystal Report v9.0 on an ASP .NET Web Form using the Crystal Web Viewer
-data retrieved from a SLQ Server 2000 Stored Procedure using an OLE DB (ADO) data source
-Application is developed using J#
-Code:
System.DateTime dtVar;
dtVar = new System.DateTime(2003,1,03);
pdvStartDate = new CrystalDecisions.Shared.ParameterDiscreteValue();
pdvStartDate.set_Value(dtVar);
pvStartDate = new CrystalDecisions.Shared.ParameterValues();
pvStartDate.Add(pdvStartDate);
reportDocument1.get_DataDefinition().get_ParameterFields().get_Item("@iStartDate").ApplyCurrentValues(pvStartDate);

-Error Message:
[Exception: Exception of type System.Exception was thrown.]
CrystalDecisions.Web.ReportAgent.v(Boolean `)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()

-if I comment out this code and set a default value in the report, the report displays successfully

Look forward to hearing about the simple fix I am missing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top