i have an asp.net web app. the sql data adapter selects the required fields from a view. i then export the dataset to pdf using two parameter fields. these are alphanumeric fields that being with two letters of the alphabet and have a range of numbers after them. e.g. EQ001, IS888 - the letters vary. instead of using the parameters all rows are returned regardless of what parameters are chosen. below is my asp.net code:
private void Button1_Click(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.dataSet21);
rptGETASSETS crReportDocument = new rptGETASSETS();
crReportDocument.SetDataSource(dataSet21);
ParameterValues myparameterValues = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue = new ParameterDiscreteValue();
myparamDiscreteValue.Value = DropDownList2.SelectedItem.Value.ToString();
myparameterValues.Add(myparamDiscreteValue);
crReportDocument.DataDefinition.ParameterFields["FromCode"].ApplyCurrentValues(myparameterValues);
ParameterValues myparameterValues2 = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue2 = new ParameterDiscreteValue();
myparamDiscreteValue2.Value = DropDownList3.SelectedItem.Value.ToString();
myparameterValues2.Add(myparamDiscreteValue2);
crReportDocument.DataDefinition.ParameterFields["ToCode"].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 parameters in the crystal report are FromDate and ToDate. the formula selections fields stipulate the following conditions for each:
{ma_asset.ASSET_CODE} >= {?FromCode}
{ma_asset.ASSET_CODE} <= {?ToCode}
i would really appreciate any help on this.
private void Button1_Click(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.dataSet21);
rptGETASSETS crReportDocument = new rptGETASSETS();
crReportDocument.SetDataSource(dataSet21);
ParameterValues myparameterValues = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue = new ParameterDiscreteValue();
myparamDiscreteValue.Value = DropDownList2.SelectedItem.Value.ToString();
myparameterValues.Add(myparamDiscreteValue);
crReportDocument.DataDefinition.ParameterFields["FromCode"].ApplyCurrentValues(myparameterValues);
ParameterValues myparameterValues2 = new ParameterValues();
ParameterDiscreteValue myparamDiscreteValue2 = new ParameterDiscreteValue();
myparamDiscreteValue2.Value = DropDownList3.SelectedItem.Value.ToString();
myparameterValues2.Add(myparamDiscreteValue2);
crReportDocument.DataDefinition.ParameterFields["ToCode"].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 parameters in the crystal report are FromDate and ToDate. the formula selections fields stipulate the following conditions for each:
{ma_asset.ASSET_CODE} >= {?FromCode}
{ma_asset.ASSET_CODE} <= {?ToCode}
i would really appreciate any help on this.