Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetDataSet method and mutltiple result sets
Message
 
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01416914
Message ID:
01416929
Views:
53
Hi Kevin,

This is indeed helpful, but how would your dataset know the names of the tables?

We have a code in the ReportViewer.ASPX.c that does the same thing (but for one table only).

Now, say, I have a Stored Procedure that would do

select some into

select some other info

select even more info

etc.

e.g. would return our resultsets.

I have created several empty datasets with one table per each dataset for my Crystal Report.

Now, we have MereMortals framework which has GetDataSet method and you can pass the name of the SP into this method.

So, I assume that this DataSet will now have all my tables (results) from the above SP.

I'm just not getting how now should I match them? How the DataSet will know the names of my tables or how first I assign these names to the DS I returned? If I can resolve this, then I definitely can use your method - very nice.



>Naomi, if I understand your question correctly, here's a common routine I've used for years.
>
>Let's say you build a CR report against a dataset (or an XML schema representation of a typed dataset), you can "push" the data into the CR report object.
>
>I wrote a generate push method that would take any report object and any dataset - here were the 2 main functions:
>
>
>
>      public ReportDocument PushReportData
>              (DataSet DsReportData, ReportDocument oReport)
>      {
>      // Call when a report is generated
>      //   Calls SetData for the main report object
>      //   Also calls SetData for any subreport objects
>
>         this.SetData(DsReportData,oReport);
>
>         foreach(ReportDocument oSubReport in  oReport.Subreports) 
>            this.SetData(DsReportData,oSubReport);
> 
>         return oReport;
>
>      }
>
>        private void SetData
>                   (DataSet DsReportData, ReportDocument oReport)
>        {
>        // receives a DataSet and a report object (could be the 
>                                       // main object, could be a subreport object)
>
>        // loops through the report object's tables collection, 
>        // matches up the table name with the corresponding table
>        // name in the dataset, and sets the datasource accordingly
>
>        // This function eliminates the need for a developer to 
>        // know the specific table order in the report
>
>            foreach (Table oTable in oReport.Database.Tables)
>               oTable.SetDataSource
>             (DsReportData.Tables[oTable.Name.ToString()]);
>
>        } 
>
>
>
>And then here's an example that would create an instance of a new report (e.g. a TimeSheet report), and then push a dataset called dsData into the report.
>
>Obviously, dsData needs to have the same structure as the original dataset structure that was used when the report was created.
>
>
>ccCrystalManager oCrystalManager = new ccCrystalManager();
>RPT_TimeSheet oTimeSheetReport = new RPT_TimeSheet();
>
>oTimeSheetReport = oCrystalManager.PushReportData(dsData, 
>                                   oTimeSheetReport);
>
>// and then use the report object to preview or print or export
>
>
>
>Let me know if this helps...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform