2013-02-12 135 views
0

所以我在這個問題上掙扎了4個多小時,我不知道在哪裏再看。我按照ADO.NET Entity Framework本教程絕對初學者 - [參見教程] [1] [1]:http://msdn.microsoft.com/en-us/data/jj193542 我使用Microsoft SQL Server 2012,我用這個App.Config文件爲我的項目:ADO.NET EF - 無法連接到我的數據庫(使用Visual Studio 2010)

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </configSections> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"> 
     <parameters> 
     <parameter value="Data Source=sqlserver2012; Integrated Security=True; MultipleActiveResultSets=True" /> 
     </parameters> 
    </defaultConnectionFactory> 
    </entityFramework> 
</configuration> 

但我不斷收到錯誤,當我使用此代碼的錯誤是:**An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string.**

我是全新的ADO.NET Entity Framework,但正如我看到它的問題可能是在defaultConnectionFactory配置。但無論如何,我無法找到如何繼續以及如何解決這個問題。

回答

0

,如果你其實有你的本地主機代爾鋁-Zour的connectionString命名sqlserver2012 SQL Server實例應該是這樣的

<parameter value="Data Source=localhost\sqlserver2012; Integrated Security=True; MultipleActiveResultSets=True" /> 

乾杯, T.

相關問題