SqlDataSource绑定GridView问题
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:testdbConnectionString %>"
SelectCommand="SELECT * FROM [Visitor] WHERE ((@DropDownListValues LIKE '%'+ @VisitorId + '%'))">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="VisitorId" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="DropDownList1" Name="DropDownListValues"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
@DropDownListValues这个使用动态就查询不到了.如果写死一切正常. --------------------编程问答-------------------- @DropDownListValues为动态的话
可能确定不了值哦!
可否换另一种绑定 如果需要的话 我给你写个。 --------------------编程问答-------------------- SelectCommand="SELECT [au_name], [au_id] FROM [authors] WHERE ([au_id] = @au_id)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="au_id" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
@DropDownListValues 动态,后台配置 --------------------编程问答--------------------
SqlDataSource1 .SelectParameters.Add("DropDownListValues",System.TypeCode.String,DropDownList1.SelectedValue);
补充:.NET技术 , ASP.NET