Requirements:
(1) Enter query conditions in the textbox of the input box <br/> (2) use sqldatasource as the data source <br/> (3) controlparameter in selectparameter of sqldatasource is textbox <br/> (4) use gridview to output the result
ProblematicCode:
<% -- Data Source: Statistics -- %> </P> <p> <asp: sqldatasource id = "statistic_sqldatasource" runat = "server" connectionstring = "<% $ connectionstrings: connectionstring %> "<br/> selectcommand =" Exec [p_statisticwork] 0, '2017-9-9 ', '2017-9-9', '', 0, ''"> </P> <p> <selectparameters> <br/> <asp: controlparameter name = "strareaname" controlid = "textbox2" defaultvalue = ""/> <br/> </selectparameters> </P> <p> </ASP: sqldatasource>
Symptom:
(1) The query result is null.
Modified code:
<% -- Data Source: Statistics -- %> </P> <p> <asp: sqldatasource id = "statistic_sqldatasource" runat = "server" connectionstring = "<% $ connectionstrings: connectionstring %> "<br/> selectcommand =" Exec [p_statisticwork] 0, '2017-9-9 ', '2017-9-9', '', 0, ''"> </P> <p> <selectparameters> <br/> <asp: controlparameter name = "strareaname" controlid = "textbox2" defaultvalue = ""/> <br/> </selectparameters> </P> <p> </ASP: sqldatasource>
Modification:
Change defaultvalue = "" To defaultvalue = ""
The problem is resolved and the cause is unknown.