变量Connectionstring =在< asp:SqlDataSource ...中? [英] variable Connectionstring= in a <asp:SqlDataSource ... ?
问题描述
是否可以在asp:SqlDataSource构造的ConnectionString中使用
来引用我在ASPX脚本顶部定义的变量并进行初始化,例如
,在Page_Init()期间?
(我见过的唯一例子是使用硬编码的连接引用
在machine.config中定义的字符串,例如
< asp:SqlDataSource ID =" SqlDataSource2" runat =" server"
ConnectionString ="<%$ ConnectionStrings:connStrInMachConfig%>" ;
完全不知道
<%$ ...%>
魔法定义我不知所措我自己搞清楚。
)
我会感激指点。
蒂姆汉森
ConnectionStrings:connStrInMachConfig%>"
不太了解
<%
...%>
魔法定义我不知道自己想出来了。
)
我会感激指点。
Tim Hanson
你不能在服务器端控件上使用<%=%,<%#%用于
绑定。在OnPreInit中设置后面的代码值。
- 布鲁斯(sqlwork.com)
" tbh" < fe **** @ newsgroups.nospamwrote in message
news:eI ************** @ TK2MSFTNGP02.phx.gbl ...
是否可以在asp:SqlDataSource
构造的ConnectionString中引用我在ASPX脚本顶部定义的变量
并初始化,例如,在Page_Init()期间?
(我见过的唯一例子是使用硬编码的连接引用
在machine.config中定义的字符串,例如
< asp:SqlDataSource ID =" SqlDataSource2" runat =" server"
ConnectionString ="< ;%
is it possible in the ConnectionString of an asp:SqlDataSource construction
to refer to a variable i define at the top of my ASPX script and initialize,
for example, during Page_Init()?
(the only examples i have seen use hard-coded references to connection
strings defined in machine.config, e.g.
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings: connStrInMachConfig %>"
not knowing quite how the
<%$ ... %>
magic is definied i''m at a loss to figure it out on my own.
)
i''d be grateful for pointers.
Tim Hanson解决方案ConnectionStrings: connStrInMachConfig %>"
not knowing quite how the
<%
... %>
magic is definied i''m at a loss to figure it out on my own.
)
i''d be grateful for pointers.
Tim Hanson
you cannot use <%= %with server side controls, and the <%# %is for
binding. in OnPreInit set the value rom the code behind.
-- bruce (sqlwork.com)
"tbh" <fe****@newsgroups.nospamwrote in message
news:eI**************@TK2MSFTNGP02.phx.gbl...is it possible in the ConnectionString of an asp:SqlDataSource
construction to refer to a variable i define at the top of my ASPX script
and initialize, for example, during Page_Init()?
(the only examples i have seen use hard-coded references to connection
strings defined in machine.config, e.g.
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%
这篇关于变量Connectionstring =在< asp:SqlDataSource ...中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!