0

sqlDataSource を使用して、ドロップダウンのデータベースからデータを入力する必要があります。SqlDataSource はクエリ文字列を使用しています。ドロップダウンにデータが入力されていません。ここで私が間違っていることを教えてください。

ドロップダウンのコード:

<ajaxToolkit:ComboBox ID="SelectDropDown1" runat="server" DropDownStyle="DropDownList"
                    AutoCompleteMode="SuggestAppend" AppendDataBoundItems="true" Width="200px" Height="16pt"
                    Font-Size="8pt"  DataSourceID="SqlDataSource1" DataTextField="Rubric"
                 DataValueField="Rubric">

               <asp:ListItem Value="all">All</asp:ListItem>

                </ajaxToolkit:ComboBox>

SqlDataSource のコード:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Education_Data %>"

        SelectCommand="SELECT DISTINCT [Rubric] FROM [table1] WHERE ([Program] = @Program)">

        <SelectParameters>
            <asp:QueryStringParameter Name="Program" QueryStringField="Program" 
                Type="String" />
        </SelectParameters>

    </asp:SqlDataSource>
4

1 に答える 1

0

@program は何らかの方法で設定する必要があります。

このMSDNの記事では、その方法について説明します。セクション「SQL ステートメントへのパラメータの受け渡し」に移動します。

于 2013-06-06T21:28:32.773 に答える