0

次のASPコードは、フィールドPrincipal_IDの昇順でデータを表示していますが、SchoolNameのアルファベット順で表示したいと思います。誰かが私がこれを達成する方法を知っていますか

<asp:Panel ID="show_pnl" runat="server" runat="server"  GroupingText="Show Principal" Width="100%" Font-Names="verdana"
            Font-Size="Small" BackColor="white" align=center" BorderColor="white" BorderPadding="0" BorderStyle="none" BorderWidth="0px">>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ShowPrincipals_DS"
                DataKeyNames="SchoolName" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
                Font-Size="Small" Font-Names="verdana" Height="100%" Width="100%" AutoGenerateDeleteButton="True">
                <Columns>
                    <asp:BoundField DataField="Principal_ID" HeaderText="Principal ID" SortExpression="Principal_ID" />
                    <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                    <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                    <asp:BoundField DataField="UserName" HeaderText="User Name" SortExpression="UserName" />
                    <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                    <asp:BoundField DataField="SchoolName" HeaderText="School Name" SortExpression="SchoolName" />
                </Columns>
                <PagerStyle CssClass="pgr" />
                <EmptyDataTemplate>
                    No Data Available
                </EmptyDataTemplate>
                <AlternatingRowStyle CssClass="alt" />
            </asp:GridView>
            <asp:AccessDataSource ID="ShowPrincipals_DS" runat="server" DataFile="~/App_Data/MockCourt_db.mdb"
                SelectCommand="SELECT tbl_Principal.Principal_ID, tbl_Principal.FirstName, tbl_Principal.LastName, tbl_Principal.UserName, tbl_Principal.Email, tbl_school.SchoolName FROM (tbl_Principal INNER JOIN tbl_school ON tbl_Principal.School_ID = tbl_school.School_ID)"
                DeleteCommand="DELETE FROM [tbl_Principal] WHERE ([Principal_ID] = @Principal_Id)">
                <DeleteParameters>
                    <asp:Parameter Name="Principal_ID" Type="int32" />
                </DeleteParameters>
            </asp:AccessDataSource>
        </asp:Panel>
4

1 に答える 1

2

既存のクエリORDER BYに句を追加するだけです。SELECT

SELECT tbl_Principal.Principal_ID, tbl_Principal.FirstName, tbl_Principal.LastName, tbl_Principal.UserName, tbl_Principal.Email, tbl_school.SchoolName FROM (tbl_Principal INNER JOIN tbl_school ON tbl_Principal.School_ID = tbl_school.School_ID) ORDER BY tbl_school.SchoolName
于 2012-07-11T12:25:30.690 に答える