解决同一列中“字符串”和“数字”两种格式同时存在,读取时,不能正确显示“字符串”格式的问题
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.RestoreDirectory = true;
openFileDialog.DefaultExt = "xls";
openFileDialog.Filter = "Excel files(*.xls)|*.xls";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
#region Excel to DataSet
string fileName = openFileDialog.FileName;
&n

当使用C#读取Excel文件时,遇到混合数据类型的列,如字符串和数字,可能会导致某些字符串内容无法正确显示。通过在连接字符串中设置`IMEX=1`,可以确保驱动程序将所有数据都作为文本读取,从而解决这个问题。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



