本当に奇妙なことです... win 8 アプリで mdb ファイルにアクセスしようとしています。これは私の簡単なコードです:
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();
ソリューション エクスプローラーの参照で、参照を追加し、「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.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