1

Dropdownlist 由 accessdatasource 驱动,该[Being Used]字段是Yes/Noaccess 中的一种数据类型,它0/1作为输入,但 dropdownlist 将值显示为True/False而不是0/1or Yes/No。所以当我选择 fasle/true 我得到一个数据类型不匹配错误,如何解决这个问题?任何帮助表示赞赏!

 <asp:DropDownList ID="DropDownList5" runat="server" AppendDataBoundItems="True" AutoPostBack="True" CausesValidation="True" DataSourceID="AccessDataSource6" DataTextField="Being Used in Target" DataValueField="Being Used" EnableViewState="True">    
<asp:ListItem Selected="True" Text="Select Being Used or not" Value= '2' ></asp:ListItem>
        </asp:DropDownList>

           <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
           ControlToValidate="DropDownList5"></asp:RequiredFieldValidator>

        <asp:AccessDataSource ID="AccessDataSource6" runat="server" DataFile="~/App_Data/SimSEAT.mdb"
            SelectCommand="SELECT DISTINCT test.[Being Used] FROM `test` WHERE 
            ((Labs.[Lab Name])= [WhichLabName] OR [WhichLabName] = '0') AND
            (((Labs.[Target])= [WhichTarget] OR [WhichTarget] = '0')  
             )">

        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList3" Name="Lab Name"   PropertyName="SelectedValue"/>
            <asp:ControlParameter ControlID="DropDownList4" Name="Target"   PropertyName="SelectedValue" />

            </SelectParameters>
        </asp:AccessDataSource>
4

0 回答 0