Error uploading Excel file from ASP.NET application to MySQL Error uploading Excel file from ASP.NET application to MySQL asp.net asp.net

Error uploading Excel file from ASP.NET application to MySQL


I Don't Use OLDB or excel since its create many issue while reading excel

I use ExcelDataReader https://github.com/ExcelDataReader/ExcelDataReader

Try This

Install-Package ExcelDataReader

public static DataSet GetExcelDataSet(string filePath)    {        FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);        IExcelDataReader excelReader;        if (Path.GetExtension(filePath) == ".xls")        {            //Choose one of either 1 or 2            //1. Reading from a binary Excel file ('97-2003 format; *.xls)            excelReader = ExcelReaderFactory.CreateBinaryReader(stream);        }        else        {            //2. Reading from a OpenXml Excel file (2007 format; *.xlsx)            excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);        }        //Choose one of either 3, 4, or 5        //3. DataSet - The result of each spreadsheet will be created in the result.Tables        ////////DataSet result = excelReader.AsDataSet();        //4. DataSet - Create column names from first row        excelReader.IsFirstRowAsColumnNames = true;        DataSet result = excelReader.AsDataSet();        //5. Data Reader methods        //while (excelReader.Read())        //{        //    //excelReader.GetInt32(0);        //}        //6. Free resources (IExcelDataReader is IDisposable)        excelReader.Close();        return result;    }


I suspect you've hit an Excel limit (like the number of table mappings you can add)

Try starting your loop count at a higher number and see if it's the count of how many times you do this rather than the data that causes the problem. Maybe something like:

Dim x As Integer = 40002Dim y As Integer = 60001


you can reset your range......by adding counter variable....increment it for specific range...and reset it...