首先,我在StackOverflow上搜索,也查看了所有相似的答案,但无法找到任何解决方案。
app.conf文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="dtaabse.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionstrings>
<add name="Db" connectionstring="Data Source=(local);Initial Catalog =DV login pro; Integrated Security=true"
providerName="System.Data.SqlClient"
/>
</connectionstrings>
<applicationSettings>
<dtaabse.Properties.Settings>
<setting name="setting" serializeAs="String">
<value />
</setting>
</dtaabse.Properties.Settings>
</applicationSettings>
</configuration>
form.cs
档案
string connstring = ConfigurationManager.ConnectionStrings["Db"].ConnectionString;
只有此行显示错误。请帮我找到这个错误!
答案 0 :(得分:0)
它的区分大小写。将connectionstring
和connectionstrings
更改为connectionString
和connectionStrings
。
<connectionStrings>
<add name="Db" connectionString="Data Source=(local);Initial Catalog =DV login pro; Integrated Security=true"
providerName="System.Data.SqlClient"
/>
</connectionStrings>