sheet代表的是工作表?一个Excel文件里还能有好几个工作表吗?什么叫工作表?
请教下...

解决方案 »

  1.   

    操作Excel时候sheet后面要加$符号的
    [aa$]
      

  2.   

     string connectStr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=Yes;\"", "119.xls"); //IMEX=1            OleDbConnection connection = new OleDbConnection(connectStr);
                connection.Open();            try
                {
                                   DataSet ds = new DataSet();
                    OleDbDataAdapter _adapter = new OleDbDataAdapter("select * from [Sheet4$]", connection);
                    _adapter.Fill(ds, "MyTable");
                    this.dataGridView1.DataSource = ds;            }
                catch (OleDbException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                        connection = null;
                    }
                }