c# Excel导入内存问题
有一个5000列的Excel,想导入内存,但是为啥导进来的DataTalbe只有255列
DataTable有这个限制吗,代码如下
public DataSet ImportExcel(string ExcelName)
{
string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ExcelName + ";Extended Properties='Excel 12.0;HDR=No;IMEX=1';";//连接excel文件的字符串
if (ExcelName == null)
{
return null;
}
OleDbConnection odcon = new OleDbConnection(strConn);//建立连接
try
{
odcon.Open();//打开连接
}
catch(Exception ex)
{
}
System.Data.DataTable sTable = odcon.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
//return sTable;
//Sheets Name
string tableName = sTable.Rows[1][2].ToString().Trim();
if (tableName == "")
{
return null;
}
else
{
tableName = "[" + tableName + "]";
}
OleDbDataAdapter odda = new OleDbDataAdapter("select * from " + tableName, odcon);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
odda.Fill(ds);