Create a data grid and name it as dg and add the following code to Load event of the web page
It will work fine and see the result
Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\datatest.xls;Extended Properties=Excel 8.0;"
Dim objConn As New OleDbConnection(connstr)
Dim objadap As New OleDbDataAdapter("SELECT * FROM Range1", objConn)
Dim ds As New DataSet
objConn.Open()
objadap.Fill(ds, "ExcelData")
dg.DataSource = ds.Tables(0).DefaultView
dg.DataBind()
objConn.Close()
sanajmshaji
|