Sub Page_Load(sender As Object, e As EventArgs)
Dim ds As New DataSet()
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\test.xls;" & _
"Extended Properties=""Excel 8.0;"""
Dim da As New OledbDataAdapter("SELECT * FROM [Sheet1$]", strConn)
da.TableMappings.Add("Table", "Excel")
da.Fill(ds)
DataGrid1.DataSource = ds.Tables(0).DefaultView
DataGrid1.DataBind()
End Sub
Good Luck!
2 comments:
How to import data from multi-sheets of excel file? Pls write sample code.
Thanks
Chaw
Hi Chaw,
Please refer to this post -> Excel In .NET Application
Cheers!
Post a Comment