i have the following formula field called date:
{ma_asset.TRANS_DATE} > {?FromDate} and {ma_asset.TRANS_DATE} < {?ToDate}
date is stored in the db as an integer in the format 20040309. i have two parameter fields called ?FromDate and ?ToDate. They are of type number. i use a view in my asp.net form and then use the parameters to return the rows between the dates entered. here is my code:
private void Button1_Click(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.dataSet31);
this.DataGrid1.DataBind();
ExportReport();
}
private void ExportReport()
{
rptASSETSBYDATE crReportDocument = new rptASSETSBYDATE();
//this.sqlDataAdapter1.Fill(this.dstAUTHSHEETS1);
crReportDocument.SetDataSource(this.dataSet31);
ParameterValues myparameterValues = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue = new ParameterDiscreteValue();
myparamDiscreteValue.Value = TextBox1.Text;
myparameterValues.Add(myparamDiscreteValue);
crReportDocument.DataDefinition.ParameterFields["FromDate"].ApplyCurrentValues(myparameterValues);
ParameterValues myparameterValues2 = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue2 = new ParameterDiscreteValue();
myparamDiscreteValue2.Value = TextBox2.Text;
myparameterValues2.Add(myparamDiscreteValue2);
crReportDocument.DataDefinition.ParameterFields["ToDate"].ApplyCurrentValues(myparameterValues2);
string ExportPath;
ExportPath = Request.PhysicalApplicationPath;
crDiskFileDestinationOptions = new DiskFileDestinationOptions();
crExportOptions = crReportDocument.ExportOptions;
string fName = Session.SessionID.ToString() + ".pdf";
crDiskFileDestinationOptions.DiskFileName = ExportPath + fName;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crReportDocument.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(fName);
Response.Flush();
Response.Close();
}
the report displays all rows regardless of dates entered. any suggestions please?
{ma_asset.TRANS_DATE} > {?FromDate} and {ma_asset.TRANS_DATE} < {?ToDate}
date is stored in the db as an integer in the format 20040309. i have two parameter fields called ?FromDate and ?ToDate. They are of type number. i use a view in my asp.net form and then use the parameters to return the rows between the dates entered. here is my code:
private void Button1_Click(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.dataSet31);
this.DataGrid1.DataBind();
ExportReport();
}
private void ExportReport()
{
rptASSETSBYDATE crReportDocument = new rptASSETSBYDATE();
//this.sqlDataAdapter1.Fill(this.dstAUTHSHEETS1);
crReportDocument.SetDataSource(this.dataSet31);
ParameterValues myparameterValues = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue = new ParameterDiscreteValue();
myparamDiscreteValue.Value = TextBox1.Text;
myparameterValues.Add(myparamDiscreteValue);
crReportDocument.DataDefinition.ParameterFields["FromDate"].ApplyCurrentValues(myparameterValues);
ParameterValues myparameterValues2 = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue2 = new ParameterDiscreteValue();
myparamDiscreteValue2.Value = TextBox2.Text;
myparameterValues2.Add(myparamDiscreteValue2);
crReportDocument.DataDefinition.ParameterFields["ToDate"].ApplyCurrentValues(myparameterValues2);
string ExportPath;
ExportPath = Request.PhysicalApplicationPath;
crDiskFileDestinationOptions = new DiskFileDestinationOptions();
crExportOptions = crReportDocument.ExportOptions;
string fName = Session.SessionID.ToString() + ".pdf";
crDiskFileDestinationOptions.DiskFileName = ExportPath + fName;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crReportDocument.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(fName);
Response.Flush();
Response.Close();
}
the report displays all rows regardless of dates entered. any suggestions please?