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

Dynamic Dataset in ASP.NET

Status
Not open for further replies.

cathiec

Programmer
Oct 21, 2003
139
IE
I am creating a dataset in ASP.NEt dynamically based on two dates that a user selects. The dates are then passed as parameters to a stored procedure and the dataset is created with rows that have a date column between the values of the two dates that have been chosen.
My problem is that i now want to display the information in a report using crystal.
Here is the function that i am using, but i get the a query engine error.

private void ExportPDF(DataSet ds)
{
rptASSETSDATES crReportDocument = new rptASSETSDATES();
crReportDocument.SetDataSource(ds);

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();

}
i created a crystal report rptASSETSDATES using an empty dataset that has the same fields as the one that i am creating dynamically.

any suggestions??

 
I've got an app where I do essentially the same thing. Iniitally I got alot of query errors from Crystal. They went away after I created the DS as an XML DS, based the report off that and only filled the DS dynamically. I think crystal blows up if there's the slightest difference in field types or other constraints. You can fill your tables like so:

oOleCmd.CommandText = "Select * from table1"
oOleDA.Fill(ds, "table1")
oOleCmd.CommandText = "Select * From table2"
oOleDA.Fill(ds, "table2")

etc.

Good luck.
 
Thanks for that work around Alex, it worked great. I still have a small problem though.....the report is opening up fine and the column headings are displayed but there is no data. i am filling the dataset like so:

da.Fill(ds1, "dbo.SALFLDGSDE");

the name of the xml dataset that i created is ds and ds1 is an instance of this. it's like the report is not picking up the data in the dataset.

have you any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top