VS2005中DataGrideView导入Excel2003的问题,高手们帮我看看哪里没写好OpenFileDialog ofg = new OpenFileDialog();
            ofg.Filter = "Excel文件(*.xls) | *.xls";
            string filename = ofg.FileName;
            int index = filename.LastIndexOf("\\");
            filename = filename.Substring(index + 1);
            if(ofg.ShowDialog() ==DialogResult.OK)
            {
                string source = filename;
                string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" + source;
                string query = "select * from [sheet1$]";
                OleDbCommand oleCommand = new OleDbCommand(query,new OleDbConnection(ConnStr));
                OleDbDataAdapter oleAdapter = new OleDbDataAdapter(oleCommand);
                DataSet ds = new DataSet();
                oleAdapter.Fill(ds, "[sheet1$]");
                this.dataGridView1.DataSource = ds;
                dataGridView1.DataMember = "[sheet1$]";            }