I am getting this issue while trying to read data from an excel file using OleDb.
This is working fine on my test server (Window Server 2008) but not working in UAT server with the same configuration.
It used to work on the UAT server, but suddenly stopped working.
I tried solutions from these sources, but nothing worked:
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);
}
}
}
Any help would be appreciated. Thanks