<asp:SqlDataSource ID= "SqlDataSource1 " runat= "server " ConnectionString= " <%$ ConnectionStrings:duscConnectionString %> "
SelectCommand= "SELECT * FROM databs WHERE (f_cource LIKE @course + N '% ') AND (f_class LIKE @class + N '% ') AND (f_sid LIKE N '% '+@sid + N '% ') ">
<SelectParameters>
<asp:ControlParameter ControlID= "ddl_Course " Name= "course " PropertyName= "SelectedValue " DefaultValue= "% " />
<asp:ControlParameter ControlID= "ddl_Class " DefaultValue= "% " Name= "class " PropertyName= "SelectedValue " />
<asp:Parameter DefaultValue= "% " Name= "sid " />
</SelectParameters>
</asp:SqlDataSource>
sql数据源的前二参数来自控件,第三参数sid想用代码赋值实现,但找不到相应方法
目前实现方法是修改sqlcommand的sql字符串,请教高手能否直接赋值实现
------解决方案--------------------------------------------------------
SqlDataSource1.SelectParameters[ "sid "].DefaultValue = "aaaaaaa ";
------解决方案--------------------------------------------------------
还不如自己写呢。
看起来挺方便,但是复杂一点的就不好用了。
------解决方案--------------------------------------------------------
还是喜欢自己写代码实现