Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

How can I make a header line on a DataSet?

My function creates a number of DataTables and returns a DataSet, where I have used individual rows in this DataTable.


From an SQL standpoint, that is proper. But the end user of this Data Set is not SQL, it's our website, which generates an Excel sheet.


Is there a way to create a DataSet with other elements that are not DataTables? Or, is there a way to create a data table that is not all rows?


For example, instead of the DataRow method:


CUST_CODE       CUST_NAME      CUST_PURCHASE

111                       Frank                   $35

111                       Frank                   $45

222                      Jamie                    $39

333                      John                      $54


I could use headers?


===

CUST_CODE: 111, CUST_NAME : Frank

CUST_PURCHASES

$35

$45


===

CUST_CODE: 222, CUST_NAME : Jamie

CUST_PURCHASES

$39


===

CUST_CODE: 333, CUST_NAME : John

CUST_PURCHASES

$54


Is this possible?


Thanks

ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

Thanks.

The report I need to create contains groups of rows, so I need to display the header row many times, atop of 5-15 rows.

Is that possible?
You can group the result and write some custom code to display the report. If you can provide the sample output of your expectation we can help you
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That code looks great. Can you send a sample of how that data looks in report form?

Put the code to use the column names as the header into a function and just call the function again whenever you require a header row.  (In reality you just require one piece of code that will iterate any DataRow object you give it and output all the column names).

No problem.  You control the export process so you can output whatever you want to Excel.  Just remember 'one' is a piece of text to Excel, it doesn't matter if it is the header or the field content in a DataRow.

curiouswebster what was your expectation in the excel so that I can frame the code and send
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial