先写个帮助类FileUpload_Help 然后添加一个静态方法: private static bool UpLoadFile(System.Web.UI.HtmlControls.HtmlInputFile inputFile, string fileName) ... { //文件上传的路径最好是配置在Web.Config里,这就写死了 string UploldFolderName = Thread.GetDomain().BaseDirectory + @"UploadFilsExcels"; try ...{ if (Directory.Exists(UploldFolderName) == false) ...{ Directory.CreateDirectory(UploldFolderName); } ...{ inputFile.PostedFile.SaveAs(UploldFolderName + fileName); return true; } } catch ...{ return false; } } 再添加获取Excel内容的静态方法: private static DataTable GetTheExcelContent( string fileName) ... { string TheFileName = @"UploadFilsExcels" + fileName; string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + TheFileName + "';Extended Properties=Excel 8.0"; OleDbConnection connxls = null; DataSet ds = new DataSet(); try ...{ connxls = new OleDbConnection(connString); OleDbDataAdapter xlsAd = new OleDbDataAdapter("select * from [Sheet1$]", connxls); xlsAd.Fill(ds); } catch ...{ } finally ...{ if (connxls.State != ConnectionState.Closed) ...{ connxls.Close(); } } return ds.Tables[0]; } 现在两个都是私有方法,得对外暴露一个公开的方法: public static DataTable UploadFileAndGetTheContent(System.Web.UI.HtmlControls.HtmlInputFile inputFile, string fileName) ... { if (UpLoadFile(inputFile, fileName)) ...{ return GetTheExcelContent(fileName); } else ...{ return null; } } 异常处理都没写,具体使用的时候还要添更强的逻辑 不过雏形差不多就这样了