DropDownList1里面的项是自己编辑的。
写数据库命令时,在where提交里写type="&DropDownList1.SelectedValue&"测试的时候提示无效
换成DropDownList1.SelectedItem.value或者DropDownList1.value同样无效。
以下是代码:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="%">未选择</asp:ListItem>
<asp:ListItem>语文</asp:ListItem>
<asp:ListItem>数学</asp:ListItem>
<asp:ListItem>英语</asp:ListItem>请问怎样在where里面写入判断DropDownList1的值啊?
写数据库命令时,在where提交里写type="&DropDownList1.SelectedValue&"测试的时候提示无效
换成DropDownList1.SelectedItem.value或者DropDownList1.value同样无效。
以下是代码:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="%">未选择</asp:ListItem>
<asp:ListItem>语文</asp:ListItem>
<asp:ListItem>数学</asp:ListItem>
<asp:ListItem>英语</asp:ListItem>请问怎样在where里面写入判断DropDownList1的值啊?
<asp:ListItem Value="%">未选择 </asp:ListItem>
<asp:ListItem value="">语文 </asp:ListItem>
<asp:ListItem value="">数学 </asp:ListItem>
<asp:ListItem value="">英语 </asp:ListItem>
select * from Table where type="&DropDownList1.SelectedValue&"吗?
select * from Table where type=" + DropDownList1.SelectedValue;如果是字符型:
select * from Table where type='" + DropDownList1.SelectedValue + "'";