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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display rows between 2 parameters

Status
Not open for further replies.

cathiec

Programmer
Oct 21, 2003
139
IE
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top