//创建一个数据链接
string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ;
Data Source = c:\\sample.xls;Extended Properties=Excel 8.0" ;
OleDbConnection myConn = new OleDbConnection ( strCon ) ;
string strCom = " SELECT * FROM [Sheet1$] " ;
myConn.Open ( ) ;
file://打开数据链接,得到一个数据集
OleDbDataAdapter myCommand = new OleDbDataAdapter ( strCom , myConn ) ;
file://创建一个 DataSet对象 myDataSet = new DataSet ( ) ;
file://得到自己的DataSet对象 myCommand.Fill ( myDataSet , "[Sheet1$]" ) ;
file://关闭此数据链接 myConn.Close ( ) ;