<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT ProductName, ProductPrice FROM Product WHERE (@type LIKE '%' + @seach + '%')">
<SelectParameters>
<asp:QueryStringParameter Name="type" QueryStringField="type" />
<asp:QueryStringParameter Name="seach" QueryStringField="search" />
</SelectParameters>
</asp:SqlDataSource>
The problem is I cannot get any return results at all because og @type
.
If I change the @type
to ProductName
it works fine,
but I want the @type
value be a dynamic value that can choose by user
and is passed in by using QueryString
. How can I solve this kind of problem?