locked
Stored Procedure to create a cross-tab query RRS feed

  • Question

  • User1312450783 posted

    Hello,

    Can anyone point me in the right direction on how to write a stored procedure to create a cross tab query within ASP.net? I can create the output I need exactly the way I want in MS Access - but can't seem to get it displayed in a grid-view within ASP.net.  Here is the sql I'm using that works in Access:

    ********************************************

    TRANSFORM Sum(EmployeeHoursTotals.Hours) AS SumOfHours
    SELECT EmployeeHoursTotals.Employee, EmployeeHoursTotals.LastName, EmployeeHoursTotals.FirstName, Sum(EmployeeHoursTotals.Hours) AS [Total Of Hours]
    FROM EmployeeHoursTotals
    GROUP BY EmployeeHoursTotals.Employee, EmployeeHoursTotals.LastName, EmployeeHoursTotals.FirstName
    PIVOT EmployeeHoursTotals.Building;

    ****************************************

    Thanks! Any help would be great appreciated!




    Monday, August 16, 2010 1:49 PM

Answers

  • User1716267170 posted

    I can create the output I need exactly the way I want in MS Access - but can't seem to get it displayed in a grid-view within ASP.net.

    Is there any problem with displaying the retrieved data in gridview control? The simplest way is to set AutoGenerateColumns property as true and bind the datasource directly. Please clarify the question if I misunderstood it.

    Thanks. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 17, 2010 11:31 PM