1
我有一个连接到SQL Server的ASP.Net Web应用程序。 web.config
有<connectionStrings/>
。看来web.config
未在运行时读取,并且它会导致数据绑定控件在与“ConnectionString属性尚未初始化”Web.config未被读取(VS 2010)?
我的连接字符串使用系统DSN,并出现跟随connectionStrings Element运行失败。 DSN测试正确,当我在控件的属性上使用来自web.config
的连接字符串时,一切正常。
编辑:它吹在Visual Studio生成线grvSysStatus.DataBind()
。这里是代码:
<asp:GridView ID="grvSysStatus" runat="server" GridLines="None" AutoGenerateColumns="False" Width="95%" showHeader="False">
<Columns>
<asp:BoundField DataField="message_text" />
</Columns>
</asp:GridView>
任何想法?
感谢, 杰夫
<configuration>
<connectionStrings>
<add name="MasterTraq_Dev"
connectionString="Dsn=MasterTraq_Dev;uid=xxxxx;pwd=yyyyy;trusted_connection=No;app=Microsoft® Visual Studio® 2010;wsid=zzzzz;database=MasterTraq_Dev"
providerName="System.Data.Odbc"
/>
</connectionStrings>
...
</configuration>
大声笑....当我从下拉列表中选择DSN时,Visual Studio创建了字符串:) – jww
我尝试了一个来自URL的样本字符串,没有喜悦。 Visual Studio(或Web服务器模拟器)的行为就像它没有读取配置文件:“ConnectionString属性尚未初始化”。为什么在'web.config'中它需要属性集(在几百个地方)?集中管理是将其移至'web.config'的关键。 – jww
什么是实际的数据源? –