Sql server SQL Server连接错误:配置系统初始化失败
在尝试连接到sql server时,我在winform中遇到此错误,但不明白原因。错误如下:配置系统未能初始化 这是我的密码:Sql server SQL Server连接错误:配置系统初始化失败,sql-server,vb.net,Sql Server,Vb.net,在尝试连接到sql server时,我在winform中遇到此错误,但不明白原因。错误如下:配置系统未能初始化 这是我的密码: connectionString = ConfigurationManager.ConnectionStrings("Connect5").ConnectionString Dim myConnection As New SqlConnection(connectionString) myConnection.Open(
connectionString = ConfigurationManager.ConnectionStrings("Connect5").ConnectionString
Dim myConnection As New SqlConnection(connectionString)
myConnection.Open()
这是我的app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TestConsoleApp.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<system.diagnostics>
<sources>
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<connectionStrings>
<add name="Connect5" connectionString="Data Source=asapinc.local\SQLEXPRESSSERVER;Initial Catalog=ASAP_DATABASE; User ID=ASAP;Password=CLEAN1"/>
听起来像是断开的配置文件
您应该会在这一行的
xml
一词上看到一条红色下划线
<?xml version="1.0" encoding="utf-8" ?>
意外的XML声明。XML声明必须是第一个节点
在文档中,不允许出现空白字符
在它之前
我怀疑这是真的,但我注意到在分号和用户ID之间有一个空格:
;用户ID=
在您的配置文件中。很抱歉,app.config文件中没有红色下划线,但在第一行之前是否有空格?