using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; public partial class VisitExcel1 : System.Web.UI.Page { protectedvoid Page_Load(object sender, EventArgs e) { string strConn; strConn ="Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source=D:\\exceltest.xls;"+"Extended Properties=Excel 8.0;"; OleDbDataAdapter myCommand =new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn); DataSet myDataSet =new DataSet(); myCommand.Fill(myDataSet, "ExcelInfo"); GridView1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView; GridView1.DataBind(); } }
posted on
2007-11-27 10:02执法长老
阅读(749)
评论(0)
编辑收藏举报