控件中连接字符串的值是通过一个函数取得的,所以写代码如下:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%=DB.GetConn()%>"
SelectCommand="" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
提示错误:Keyword not supported: '<%'.
已知函数DB.GetConn()工作正常(移到本页的其他位置,可输出正确的值),该怎么写?(除去在后台页面中赋值的方法)
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%=DB.GetConn()%>"
SelectCommand="" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
提示错误:Keyword not supported: '<%'.
已知函数DB.GetConn()工作正常(移到本页的其他位置,可输出正确的值),该怎么写?(除去在后台页面中赋值的方法)
SqlDataSource1.ConnectionString = DB.GetConn();
.......
ConnectionString="Data Source=.;Initial Catalog=DBase;User ID=sa;Password=123456"
......