none
Ordered list using Gridview / Access database RRS feed

  • Question

  • I have a Gridview linked to an MS Access database, containing data for employees and the jobs (up to 2) that they perform. The database has five columns: (1) Employee; (2) Job1; (3) Job2; (4) Joblink1; (5) Joblink2. The fourth and fifth columns contain hyperlinks to profile pages for each of the jobs. I want to create a grouped list of the most common jobs in the database. I have the following code:

     

    <asp:GridView runat="server" id="GridView1" DataSourceID="AccessDataSource1">
    
    </asp:GridView>
    
    <asp:AccessDataSource runat="server" ID="AccessDataSource1" DataFile="App_Data/employeedata.mdb"
    SelectCommand="SELECT [Job1], COUNT(*) AS [Number] FROM [employeedata] GROUP BY [Job1] ORDER BY COUNT(*) DESC"> </asp:AccessDataSource>


     

    This works fine for creating an ordered list of the jobs in the Job1 column, but I want to make three refinements / variations to the output:

     

    1. Produce a list of the most common jobs in both Job1 and Job2 fields - ie one list, which combines the data from two columns.

     

    2. Express the ouput as hyperlinks rather than text, so that clicking on each job name takes you through to the profile page for that job.

     

    3. Express the output as percentages of the total rather than a sum.

     

    Any help would be much appreciated.


    Monday, June 13, 2011 9:12 AM

All replies