小编Jer*_*y22的帖子

C#错误与ExcelDataReader

最近,我试图构建一个可以读取excel文件的应用程序。但是就在我选择了excel文件后,我得到一个错误:

ExcelDataReader.dll中发生了'ExcelDataReader.Exceptions.HeaderException'

其他信息:无效的文件签名。”

错误在第38行被捕获

这是我的代码的副本

using ExcelDataReader;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Alt_jde
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void label1_Click(object sender, EventArgs e)
    {

    }
    DataSet result;
    private void btnOpen_Click(object sender, EventArgs e)
    {
        using(OpenFileDialog ofd = new OpenFileDialog() )
        {
            if (ofd.ShowDialog()==DialogResult.OK)
            {
                System.IO.FileStream fs = System.IO.File.Open(ofd.FileName, System.IO.FileMode.Open, …
Run Code Online (Sandbox Code Playgroud)

c# excel exceldatareader

2
推荐指数
1
解决办法
5483
查看次数

标签 统计

c# ×1

excel ×1

exceldatareader ×1