System.Data.OleDb.OleDbException:超出系统资源 [英] System.Data.OleDb.OleDbException: System resource exceeded
问题描述
尝试使用OleDb从excel文件读取数据时遇到此问题.
I am getting this issue while trying to read data from an excel file using OleDb.
这在我的测试服务器(Window Server 2008)上工作正常,但在具有相同配置的UAT服务器上无法正常工作.
This is working fine on my test server (Window Server 2008) but not working in UAT server with the same configuration.
它曾经在UAT服务器上工作,但突然停止工作.
It used to work on the UAT server, but suddenly stopped working.
我尝试了这些来源的解决方案,但没有任何效果:
I tried solutions from these sources, but nothing worked:
间歇性的超出系统资源"OleDB连接到Microsoft Access数据文件的异常
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
推荐答案
希望这对其他人会有所帮助.
Hope this will be helpful for others.
关于这个问题,我遍历了无数资源,并找到了许多解决方案-以编程方式和基于配置的答案,不幸的是,这些解决方案都不适合我,最后,我决定使用CSV文件代替excel.现在一切都很好.
I went through numerous resource regarding this issue and found many solutions -programmatically and configuration based answers, unfortunately, none of the solutions worked for me and finally, i decided to use CSV file instead excel. everything is working fine now.
让我知道是否有人对此问题有任何答案.
Let me know if anybody found any answer to this question.
谢谢
这篇关于System.Data.OleDb.OleDbException:超出系统资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!