新人求EXCEL导入datagridview方法,不懂原理
新人求EXCEL导入datagridview方法,不懂原理,可以互相交流,
OleDbConnection conn = new OleDbConnection("provider=microsoft.jet.oledb.4.0; data source=路径; extended properties=excel 8.0");
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", conn);
da.Fill(dt);
DataGridView1.DataSource = dt;