一些非常奇怪的事情......我試圖在我的win 8應用程序中訪問mdb文件。 這是我簡單的代碼:System.Data.Common.DbConnection無法在我的win 8應用程序中解析
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Assets/File.mdb";
string strSQL = "SELECT CF FROM Comuni WHERE Comune = '" + m_strComNasc + "'";
OleDbConnection myConn = new OleDbConnection(strConn);
OleDbCommand myCmd = new OleDbCommand(strSQL, myConn);
myConn.Open();
OleDbDataReader myReader = myCmd.ExecuteReader();
if (myReader.Read())
strConn = myReader.GetString(0);
else
strConn = "";
myReader.Close();
myConn.Close();
在Solution Explorer中引用我已經做了添加引用,並選擇「C:\ Program Files文件\參考大會\微軟\ Framework.NETFramework \ V4.5 \ System.Data。 DLL」 ......
這些都是錯誤的:
The base class or interface 'System.ComponentModel.Component' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.Data.Common.DbConnection' could not be resolved c:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll
The base class or interface 'System.ComponentModel.Component' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.Data.Common.DbCommand' could not be resolved c:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll
The base class or interface 'System.MarshalByRefObject' in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.Data.Common.DbDataReader' could not be resolved c:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll
在我的控制面板中:系統類型:32位操作系統,基於x64的處理器。我可以使用我的.mdb文件嗎?我完全更改我的代碼嗎? – CaptainAmerica 2013-04-21 16:04:05
[Windows 8商店應用程序 - 使用哪種類型的存儲?](http://stackoverflow.com/questions/13953940/windows-8-store-apps-which-type-of-storage-to-use) – Damith 2013-04-21 17:05:39