日期:2014-05-17 浏览次数:20912 次
conn.Open();
string strExcel = string.Empty;
DataTable yTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] { null, null, null, "TABLE" });
OleDbDataAdapter myCommand = null;
DataSet ds = new DataSet();
foreach (DataRow dr in yTable.Rows)
{
strExcel = "select * from [" + dr["Table_Name"].ToString() + "]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
myCommand.Fill(ds, dr["Table_Name"].ToString());
}
conn.Close();
return ds;