我正在尝试使用Unity中的OleDB连接读取dbf文件。我在Visual Studio中使用C#成功运行了一个项目。虽然当我在Unity中尝试时会收到NotImplementedException:OleDb未实现。
static public void readDBF()
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\;Extended Properties=dBASE IV;User ID=;Password=;"); // give your path directly
try
{
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from ydr.dbf", con); // update this query with your table name
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
int i = ds.Tables[0].Rows.Count;
if (ds.Tables.Count > 0)
PrintDataSet(ds);
else
{
Console.WriteLine("Empty");
}
}
catch (Exception e)
{
var error = e.ToString();
// check error details
throw;
}
}