Hi

I did the stored procedure in mssql 2012. working fine in server.

I have an issue that I need the output of my SP into HTML Report Format in aspx.page with Sub and Grand Total
I no need GridView

Pls advice

Maideen
My SP

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Z_usp_Circ_Details_Member]

AS
BEGIN

    SET NOCOUNT ON;
    SELECT * FROM (SELECT 
    MEMBER,[LANGUAGE],[TYPE],[PLATFORM],copies,CATEGORY,MAINAREA,YearNo
    FROM Z_tbl_Circulation_Details where mainarea='Peninsular Malaysia' and Language='English') TableYearNo
    pivot (Sum(copies) for [member] in ([The sun],[The Star]))pivotTable
END

Results

English Newspaper   Print   Free    Peninsular Malaysia 2012    603706  5210
English Newspaper   Print   Free    Peninsular Malaysia 2013    301853  98754
English Newspaper   Print   Paid    Peninsular Malaysia 2012    2547    569146
English Newspaper   Print   Paid    Peninsular Malaysia 2013    3257    284573

Recommended Answers

All 2 Replies

If you want the HTML directly from the SP, you can do something like:

SELECT 
   '<tr><td>' + MEMBER + '</td><td>' + [LANGUAGE] + '</td><td>' + [TYPE] + '</td></tr>'...

But it's much more elegant if you use and asp:Template or even a foreach loop to create your html.
Databases are supposed to return data, not html.

for the first, you can get all your store procedure data at your code and store the data on new class or array.
after that, parse class data to your HTML

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.