0
我在嘗試從使用OleDb的Excel文件讀取數據時遇到此問題。System.Data.OleDb.OleDbException:超出系統資源
這對我的測試服務器(Window Server 2008)正常工作,但不能在具有相同配置的UAT服務器中工作。
它曾經在UAT服務器上工作,但突然停止工作。
我試圖從這些來源的解決方案,但是毫無效果:
Intermittent "System resource exceeded" exception for OleDB connection to Microsoft Access data file
OleDbException System Resources Exceeded
using (OleDbConnection conn = new OleDbConnection(connectionString))
{
using (OleDbCommand cmd = new OleDbCommand())
{
using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter())
{
cmd.Connection = conn;
//Fetch 1st Sheet Name
//conn.Open();
DataTable dtSchema;
dtSchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
string ExcelSheetName = dtSchema.Rows[0]["TABLE_NAME"].ToString();
//conn.Close();
////Read all data of fetched Sheet to a Data Table
//conn.Open();
cmd.CommandText = "SELECT * From [" + ExcelSheetName + "] Where (F3 = 'Reconstructive' OR F3 = 'Neurovascular' OR F3 = 'Orthobiologics') AND F2 = '"+ SterileProduct.CatalogNumber +"'";
dataAdapter.SelectCommand = cmd;
dataAdapter.Fill(dt);
}
}
}
任何幫助,將不勝感激。 謝謝