I need set 3 parameters in SQLDatasource, binding source to the gridview.
If I remove the parameters, and directly choose datasource from design view, it shows data correctly.
I guess after pass parameters, Oracle has some special way to handle the SQL, but once the parameter passed, gridview got nothing to display. How can I fix this?
See the aspx code:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT d.* FROM DECODATA D where (D.FAMILY like :family) AND (D.SERIES like :series) AND (D.MODEL like :model) ORDER BY D.FAMILY, D.SERIES, D.MODEL">
<SelectParameters>
<asp:Parameter Name="family" />
<asp:Parameter Name="series" />
<asp:Parameter Name="model" />
</SelectParameters>
</asp:SqlDataSource>
The front code is automatically created.
Code-behind: Search Button: Even I hard code the parameters like that, still not working (This parameters setting works in SQL Server I know)
SqlDataSource1.SelectParameters["family"].DefaultValue = "CLASSIC LOW";
SqlDataSource1.SelectParameters["series"].DefaultValue = "%";
SqlDataSource1.SelectParameters["model"].DefaultValue = "%";
GridView1.DataSource = SqlDataSource1;
GridView1.DataBind();