2011-08-03 70 views
0

我有visual studio 2010.和sql管理工作室2008.我已經安裝了所有的Sql CE工具,並且使用visual studio創建了一個新的CE數據庫(通過點擊藍色的「配置數據源」超鏈接)。爲什麼不能連接到Sql CE數據庫?

我有我的.NET 4.0組頁下面的代碼:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Data.Sql; 
using System.Data.SqlClient; 
using System.Data; 
using System.Data.SqlServerCe; 
using System.Data.SqlClient; 

namespace EasyMediaServer 
{ 
    public partial class TestCeConnection : EMSPage 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      SqlCeConnection conn = new SqlCeConnection(@"Data Source=C:\Dropbox\Software Development\EMS\data\EMS.sdf"); 
      SqlCeCommand myCommand = new SqlCeCommand("Select * from tbl_media"); 
      myCommand.Connection = conn; 

      conn.Open(); 

      SqlCeDataReader myReader = myCommand.ExecuteReader(); 

      conn.Close(); 

     } 
    } 
} 

,但我得到了以下錯誤:

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

這是怎麼回事?這篇文章是指CE 3.5 ...

+0

在MSDN論壇這個線程可能會有所幫助:http://social.msdn.microsoft.com/Forums/en- US/sqlce/thread/d58b4b67-94a8-4478-b51f-c08f2f39ff43/ –

+0

對於初學者,我不會使用Dropbox託管數據文件。你在問問題。 – nathanchere

回答

相關問題