my codeline is:
Excel excel=new Excel();
excel.Open(@"E:\SHEETLOT.CSV",FileFormatType.CSV);
int rowLength=excel.Worksheets["SHEETLOT"].Cells.MaxRow-excel.Worksheets["SHEETLOT"].Cells.MinRow+1;
DataTable table=excel.Worksheets["SHEETLOT"].Cells.ExportDataTable(0,0,373,4);
int tableLength=table.Rows.Count;
int a1=Convert.ToInt32(table.Rows[1][0]);
int a2=Convert.ToInt32(table.Rows[1][1]);
int a3=Convert.ToInt32(table.Rows[1][2]);
When the code run to the 4th line, it was interrupted by:
未处理的“System.ArgumentException”类型的异常出现在 system.data.dll 中。
其他信息: System.FormatException: 输入字符串的格式不正确。
at System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info)
at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.Convert.ToDouble(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToDouble(IFormatProvider provider)
at System.Convert.ToDouble(Object value)
at System.Data.Common.DoubleStorage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)不能在 Column3 列中存储 。所需类型是 Double。
but When I use DataTable table=excel.Worksheets["SHEETLOT"].Cells.ExportDataTable(0,0,372,4); it can run.
Is there anything wrong about my CSV files?
Thank you!