小新二三事 二三事 電視精/戲院 ASP .NET 新手工作日誌

2009年7月10日星期五

ASP.NET Code: SQL SELECT command based on DropDownList

ASP.NET Code: SQL SELECT command based on DropDownList

SQL SELECT command based on DropDownList

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="SELECT * FROM [menu] WHERE (([region] = @region) AND ([lang] = @lang)) ORDER BY [menuId]"
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="region"
PropertyName="SelectedValue" Type="String" />
<asp:Parameter DefaultValue="1" Name="lang" Type="String" />
</SelectParameters>

沒有留言: