简体   繁体   English

具有Microsoft SQL Server数据库的C#Winform应用程序

[英]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.

相关问题 C#Winform选择要连接的SQL Server和数据库 - C# Winform select SQL Server and database to connect to 如何在C#Winform中将用户添加到SQL Server数据库 - How to add users to a SQL Server database in a C# Winform 如何检查SQL Server数据库C#winform中是否存在记录? - How to check if a record exists in the SQL Server database C# winform? 如何在C#Winform中填充SQL Server数据库 - How to fill a SQL Server database in a C# winform 使用C#WinForm向SQL Server数据库添加批量值 - Adding bulk values to SQL Server database with c# winform 运行一个C#.NET Winform应用程序,该应用程序通过仅将.mdf文件放在用户PC上而将SQL Server用作数据库 - Run a C# .NET Winform application, which uses SQL Server as database by only placing the .mdf files on the user PC 努力将记录从我的C#WinForm应用程序插入“ SQL Server Compact 4.0数据库”。 (我正在使用VS 2010) - Struggling to insert record into “SQL Server Compact 4.0 Database” from my C# WinForm Application. (I'm using VS 2010)) 无法在C#WinForm应用程序中写入数据库 - Trouble writing to database in C# WinForm Application C#Winform程序连接到SQL数据库 - c# winform program connect to a sql database C#Winform数据库服务器资源管理器控件 - C# winform database server explorer control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM