我正在尝试将我的数据库导出为.Net SqlClient数据提供程序格式,但我不断收到此错误消息 操作无法完成 附加信息: ConnectionString属性尚未初始化。 (System.Data)
计划地点: 代码:
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Dts.DtsWizard.DTSWizard.GetOpenedConnection(WizardInputs wizardInputs, String connEntryName)
at Microsoft.SqlServer.Dts.DtsWizard.Step2.OnLeavePage(LeavePageEventArgs e)
but my app config has the connection string declared as
code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="WindowsApplication2.My.MySettings.ConnectionString"
connectionString="Data Source=ARULJUSTIN\SQLEXPRESS;Initial Catalog=firemaintain;Integrated Security=True;Pooling=False"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
</configuration>
答案 0 :(得分:0)
<connectionStrings>
<add name="ConnectionString" connectionString="data source=ARULJUSTIN\SQLEXPRESS;Initial Catalog=firemaintain;Integrated Security=True;Pooling=False"
providerName="System.Data.SqlClient" />
</connectionStrings>
并访问它尝试使用
System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString