我正在用C#编写.NET应用程序。 该应用程序使用Visual FoxPro OLEDB提供程序读取FoxPro .DBF。
允许您读取.DBF文件的功能无法检测到.CDX文件并进行慢速查询。如何使用.cdx文件读取.dbf文件?
public DataTable ReadDbf(string path,string str_sql)
{
string constr = "Provider=VFPOLEDB;Data Source=" + path;
OleDbConnection con = new OleDbConnection();
con.ConnectionString = constr;
con.Open();
OleDbdataAdapter adapter = new OleDbdataAdapter(str_sql,con);
DataTable dt = new DataTable();
adapter.Fill(dt);
con.Close();
return dt;
}
我的路径和str_sql示例。
path ="C:\Users\kahla.mir\Desktop\201901"
str_sql = Select * From 100307_fct where prodid = "000038" and srcid = "001190" and perid = "000001"