[英]C# winform application with Microsoft SQL Server database
I developed a small application in C# in which I use a SQL Server database, but when I run my application I get this error: 我在C#中开发了一个小型应用程序,在其中使用SQL Server数据库,但是在运行应用程序时出现此错误:
An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll System.Configuration.dll中发生类型为'System.Configuration.ConfigurationErrorsException'的未处理异常
Additional information: Configuration system failed to initialize 附加信息:配置系统初始化失败
Can anyone help me fix this error? 谁能帮我解决此错误?
The code of my save button shown in this image where exception error occurred and My app.config. 此图像中显示了发生异常错误的“我的保存”按钮的代码以及“我的app.config”。 file is: 文件是:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionstring>
<add name="dbx" connectionstring="Data Source=JAWADKHAN-PC;Initial Catalog=jawad;Integrated Security=True" Providername="System.Data.SQLClient">
</add>
</connectionstring>
</configuration>
Check your app.config file. 检查您的app.config文件。 Add configSections after configuration section. 在配置部分之后添加configSections。 change sequence like : 更改顺序如下:
<configuration>
<configSections>
....
</configsections>
.
.
if this does not solve your problem then post app.config file to review. 如果这不能解决您的问题,请发布app.config文件进行审查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.