我正在使用 oledbcommand 的对象从 dBase4 数据库中获取数据并将其加载到数据表中。但是在 5-10 分钟左右获取 160 条记录需要太多时间。请帮帮我。
代码:
using (OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" + TrendFilePath + "\\" + Pathname + ";" + @"Extended Properties=dBASE III;"))
using (OleDbCommand cm = cn.CreateCommand())
{
cn.Open();
for (int L = 0; L <= months; L++)
{
DataTable dt_Dbf = new DataTable();
From_Date = DateTime.ParseExact(frmdate, dateFormat2, provider);
From_Date = From_Date.AddMonths(L);
int month = From_Date.Month;
string year = "1" + From_Date.Year.ToString().Substring(2, 2);
if (L == 0)
{
cm.CommandText = @"SELECT * FROM 128.DBF where DATE_Y ="
+ year + " and DATE_M = " + month + " and DATE_D>=" + From_Day + "";
dt_Dbf.Load(cm.ExecuteReader(CommandBehavior.CloseConnection));
}
}
}