【问题标题】:C# winform application with Microsoft SQL Server database带有 Microsoft SQL Server 数据库的 C# winform 应用程序
【发布时间】:2017-09-03 21:23:39
【问题描述】:

我用 C# 开发了一个使用 SQL Server 数据库的小型应用程序,但是当我运行我的应用程序时出现以下错误:

System.Configuration.dll 中出现“System.Configuration.ConfigurationErrorsException”类型的未处理异常

附加信息:配置系统初始化失败

谁能帮我解决这个错误?

The code of my save button shown in this image where exception error occurred 和 我的 app.config。文件是:

<?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>

【问题讨论】:

  • 请向我们展示您的app.config 文件! 配置系统显然有问题(正如异常消息明确指出的那样)
  • 应用程序无法加载配置部分,在这里发布您的 app.config 肯定会有所帮助。
  • Edit您的问题使用相关的保存代码而不是图像链接。

标签: c# .net sql-server winforms


【解决方案1】:

检查您的 app.config 文件。 在配置部分之后添加 configSections。 改变顺序,如:

 <configuration>
     <configSections>
      ....
     </configsections>
     .
     .

如果这不能解决您的问题,请发布 app.config 文件以供审核。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多