将虚拟行插入 OleDbDataAdapter 实例

Insert Dummy Row Into OleDbDataAdapter Instance

我有一个 excel sheet 从中读取数据,我正在使用 OleDbDataAdapter.Fill 用 sheet 数据填充数据表。我遇到的问题是字符数超过 256 的单元格被截断了。我做了一些研究,发现如果前 8 行中没有大于 256 个字符的字符串,则后面的任何单元格都会被截短。为了解决这个问题,我试图在最开始插入一个虚拟行 longText 插入到被截断的列中。最好的方法是什么?我试过使用 da.InsertCommand.CommandText 属性,但它似乎只插入到 table 的末尾。这是我的代码:

string longText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Consectetur a erat nam at. Elementum integer enim neque volutpat ac tincidunt vitae semper quis. Risus in hendrerit gravida rutrum quisque non. Amet luctus venenatis lectus magna fringilla. Lacus sed viverra tellus in hac habitasse platea dictumst vestibulum. Lectus magna fringilla urna porttitor rhoncus dolor purus non enim. Nulla aliquet porttitor lacus luctus. Massa id neque aliquam vestibulum morbi blandit. Aliquet nibh praesent tristique magna sit amet purus gravida quis. Senectus et netus et malesuada fames ac turpis egestas. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper. Donec ac odio tempor orci. Mauris ultrices eros in cursus turpis massa tincidunt dui. Quis ipsum suspendisse ultrices gravida. Dictum non consectetur a erat nam at lectus. Nam at lectus urna duis convallis convallis. In dictum non consectetur a erat nam at. Risus nec feugiat in fermentum posuere urna nec.";

da = new OleDbDataAdapter("SELECT * FROM [" + tableName + "]", connection);

// I would like to insert a row at the very beginning of da here

da.Fill(dt);

使用 ExcelReader Nuget Package

FileStream stream = File.Open(strFileName, FileMode.Open,
FileAccess.Read);   
IExcelDataReader excelReader =
ExcelReaderFactory.CreateOpenXmlReader(stream);   
DataSet result = excelReader.AsDataSet();  
DataTable dt= result.Tables[0]; 
excelReader.Close();