谁能解释下啊?<%$ %> 这是什么意思啊?送分10分,谢谢!!!!!!!!
aspx里:
<form id= "form1 " runat= "server ">
<asp:GridView ID= "GridView1 " DataSourceID= "SqlDataSource1 " runat= "server " />
<asp:SqlDataSource ID= "SqlDataSource1 " runat= "server "
SelectCommand= "SELECT [au_id], [au_lname], [au_fname], [phone], [address], [city], [state], [zip], [contract] FROM [authors] "
ConnectionString= " <%$ ConnectionStrings:Pubs %> " />
</form>
webconfig里:
<connectionStrings>
<!--
This connection is inherited from the ASP.NET Quickstart Web.config file
Uncomment this section to edit the sample locally
<add name= "Pubs " connectionString= "Server=(local)\SQLExpress;Integrated Security=True;Database=pubs;Persist Security Info=True "
providerName= "System.Data.SqlClient " />
<add name= "Northwind " connectionString= "Server=(local)\SQLExpress;Integrated Security=True;Database=Northwind;Persist Security Info=True "
providerName= "System.Data.SqlClient " />
<add name= "Contacts " connectionString= "Server=(local)\SQLExpress;Integrated Security=True;Database=Contacts;Persist Security Info=True "
providerName= "System.Data.SqlClient " />
-->
<add name= "NorthwindOLEDB " connectionString= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|Northwind.mdb; "
providerName= "System.Data.OleDb " />
<add name= "ContactsDatabase " connectionString= "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=true; "
providerName= "System.Data.SqlClient " />
</connectionStrings>
<system.web>
<pages styleSheetTheme= "Default "/>
<caching>
<sqlCacheDependency enabled= "true " pollTime= "1000 ">
<databases>
<add name= "Pubs " connectionStringName= "Pubs "/>
</databases>
</sqlCacheDependency>
</caching>
</system.web>
为什么要注释掉webconfig里的那段呢?这可是quickstudy里的查看源代码啊!!
有大人能解释下吗?如果您嫌分不够我还可以补~谢谢~
[解决办法]
这是用$来访问定制的expressions
可以参考:
http://www.cnblogs.com/shanyou/archive/2007/02/20/652757.html
[解决办法]
ConnectionString= " <%$ ConnectionStrings:Pubs %> " />
这个是ASP.NET2.0里专门用来表示 web.config 中的连接字符串的. asp.net 1.1里是没有的
[解决办法]
ASP.NET 2.0新增的语法,表达式绑定,详情见VS2005帮助。