C# Code
  ---------------------------------------------
  <%@ Page Language="C#" %>
  <%@ Import Namespace="System.Data" %>
  <%@ Import Namespace="System.Data.ADO" %>
  <script language="C#" runat="server">
  protected void Page_Load(Object Src, EventArgs E)
  {
  string strConn;
  strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
  +"Data Source=C:\\exceltest.xls;"
  +"Extended Properties=Excel 8.0;";
  ADODataSetCommand myCommand = new ADODataSetCommand("SELECT * FROM [Sheet1$]", strConn);
  DataSet myDataSet = new DataSet();
  myCommand.FillDataSet(myDataSet, "ExcelInfo");
  DataGrid1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView;
  DataGrid1.DataBind();
  }
  </script>
  <p><asp:Label id=Label1 runat="server">Excel表格内容:</asp:Label></p>
  <asp:DataGrid id=DataGrid1 runat="server"/>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-06-26
  • 2021-12-14
  • 2021-08-15
猜你喜欢
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2021-09-10
  • 2022-02-12
相关资源
相似解决方案