C#中读取EXCEL文件数据,读取不到第一行数据解决方案

原连接字符串为(strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + filePath + ";" + "Extended Properties=Excel 12.0 Xml;";

当第一行不为标题为数据时,读取不到第一行数据,后面把连接字符串改为(strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + filePath + ";" + "Extended Properties=\"Excel 12.0 Xml;HDR=NO\"";),就可以成功读取到文件中的第一行数据。

猜你喜欢

转载自blog.csdn.net/m0_37954004/article/details/81018959