2008-03-20 取得Excel工作表 3617 0 ASP.NET 取得Excel工作表 Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim path As String = "C:\Inetpub\wwwroot\LedMES_web\ex2\四元報表_20061207050512.xls" Dim ConStr As String = "provider=microsoft.jet.oledb.4.0;data source=" & path & _ ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""" Dim con As New OleDbConnection(ConStr) con.Open() Dim table As DataTable = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing) Me.GridView1.DataSource = table Me.GridView1.DataBind() con.Close() End Sub ASP.NET 回首頁