Dear All,
I have a problem to pass a query to CrystalReportViewer.SelectionFormula. Here is my query :
sParam = " {qryGLTRX.TrxDate} >= \'" + Convert.ToDateTime(sTGL1) + "\'"; sParam = sParam + " and {qryGLTRX.TrxDate} <= " + "\'" + Convert.ToDateTime(sTGL2) + "\'"; sParam = sParam + " and {qryGLTRX.Trxactno} >= " + "\'" + sCOA1 + "\'"; sParam = sParam + " and {qryGLTRX.Trxactno} <= " + "\'" + sCOA2 + "\'";
I want to pass that query to CrystalReportViewer.SelectionFormula = sParam
CrystalReportViewer1.ReportSource = rptDoc; CrystalReportViewer.SelectionFormula = sParam; rptDoc.Refresh();
Is it possible to do this ?
I always get an error like this below
FormulaException was unhandled by user code A date-time is required here. Details: errorKind Error in File ledger_card {553AD865-BB07-4ED3-AD49-8D36EEC3B4A5}.rpt: Error in formula Record_Selection: ' {qryGLTRX.TrxDate} >= '4/1/2014 12:00:00 AM' and {qryGLTRX.TrxDate} <= '5/2/2014 12:00:00 AM' and {qryGLTRX.Trxactno} >= '20000000' and {qryGLTRX.Trxactno} <= '30000000'' A date-time is required here. Details: errorKind
Does anyone know how to solve this problem ?
Regards,
Sentoso