写操作期间发生磁盘错误.(来自HRESULT的异常:0x8003001D(STG_E_WRITEFAULT)) [英] A disk error occurred during a write operation. (Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT))
问题描述
我正在使用EPPlus读取vb.net中的.csv文件.运行此代码时,出现错误写操作期间发生磁盘错误.
I am using EPPlus to read .csv file in vb.net. When I run this code, I get the error "A disk error occurred during a write operation.
(HRESULT的异常:0x8003001D(STG_E_WRITEFAULT))"
(Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT))"
这是我的代码:
Public Function ImportExcelSheet(ByVal filePath As String) As DataTable
Dim dtImportData As New DataTable()
Try
'If csv file have header then "true" else "false"
Dim hasHeader As Boolean = True
Using pck = New OfficeOpenXml.ExcelPackage()
Using stream = File.OpenRead(filePath)
pck.Load(stream)
End Using
我该怎么做才能解决此错误?
What should I do to fix this error?
推荐答案
我为从excel导入而创建的插件遇到了相同的错误.最初,我将导入文件另存为.xls.
I had the same error with a plugin I had created to import from excel. Originally I had saved the import file as .xls.
我打开了这个excel电子表格,并更名为.xlsx.
I opened this excel spreadsheet and resaved as .xlsx.
这解决了问题.
因此,可能是csv另存为的文件格式.
So maybe it is the file format that the csv was saved as.
这篇关于写操作期间发生磁盘错误.(来自HRESULT的异常:0x8003001D(STG_E_WRITEFAULT))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!