0
假设你有一个SqlDataSource,看起来像这样:控制不绑定到SqlDataSource的页面加载空白参数
<asp:SqlDataSource ID="sqldsSample" runat="server"
ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
SelectCommand="SELECT [col1], [col2] FROM [tbl] WHERE [col3] = @val) ORDER BY [col1] DESC;">
<SelectParameters>
<asp:Parameter DefaultValue="False" Name="val" Type="Boolean" />
<asp:Parameter DefaultValue="" Name="val2" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
只是假设你已经决定要在这里宣布“VAL2”参数,你不希望在后面的代码隐藏中添加和/或删除参数(例如,要将SelectCommand更改为使用某些额外条件进行某些过滤)。
它会失败,没有错误 - 控件将显示为空。