R
Rick Thiel
Hello,
I am trying to build a Crystal report VisualStudio.NET for an ASP.NET
application. I would like to build a report that doesn't connect to
any particular database at design time because I am planning to pass a
dataset to the report at runtime. From what I have read, it sounds
like unbound fields might be the answer. However, I am having trouble
figuring out how to bind these unbound fields to my dataset at
runtime.
Any help would be greatly appreciated! thanks, --Rick
//Here is the code I have so far...
ReportDocument crReportDocument = new ReportDocument();
//Grab the dataset from session
DataSet ds = (DataSet)Session["CRDataset"];
DataTable dt = ds.Tables["MY_TABLE"];
//load the report from disk
crReportDocument.Load(@"C:\Inetpub\wwwroot\MyApp\Reports\MySummary.rpt");
crReportDocument.SetDataSource(dt);
//*****************************
// TODO: I have an unbound field named "UnboundString1"
// I need to assign a column from the dataset to that field.
// Is that possible on an ASP.NET application
//*****************************
//set the options for saving the exported file to disk
DiskFileDestinationOptions dfdOptions = new
DiskFileDestinationOptions();
dfdOptions.DiskFileName = strPathFname;
//set the exporting information
ExportOptions crExportOptions = new ExportOptions();
crExportOptions = crReportDocument.ExportOptions;
crExportOptions.DestinationOptions = dfdOptions;
crExportOptions.ExportDestinationType =
ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
//Export the report and write the file to the client browser
crReportDocument.Export();
I am trying to build a Crystal report VisualStudio.NET for an ASP.NET
application. I would like to build a report that doesn't connect to
any particular database at design time because I am planning to pass a
dataset to the report at runtime. From what I have read, it sounds
like unbound fields might be the answer. However, I am having trouble
figuring out how to bind these unbound fields to my dataset at
runtime.
Any help would be greatly appreciated! thanks, --Rick
//Here is the code I have so far...
ReportDocument crReportDocument = new ReportDocument();
//Grab the dataset from session
DataSet ds = (DataSet)Session["CRDataset"];
DataTable dt = ds.Tables["MY_TABLE"];
//load the report from disk
crReportDocument.Load(@"C:\Inetpub\wwwroot\MyApp\Reports\MySummary.rpt");
crReportDocument.SetDataSource(dt);
//*****************************
// TODO: I have an unbound field named "UnboundString1"
// I need to assign a column from the dataset to that field.
// Is that possible on an ASP.NET application
//*****************************
//set the options for saving the exported file to disk
DiskFileDestinationOptions dfdOptions = new
DiskFileDestinationOptions();
dfdOptions.DiskFileName = strPathFname;
//set the exporting information
ExportOptions crExportOptions = new ExportOptions();
crExportOptions = crReportDocument.ExportOptions;
crExportOptions.DestinationOptions = dfdOptions;
crExportOptions.ExportDestinationType =
ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
//Export the report and write the file to the client browser
crReportDocument.Export();