tryNamespace System.Data.OleDb 
Public Class ExcelDG 
Inherits System.Web.UI.Page 
Protected WithEvents ExcelGrid As System.Web.UI.WebControls.DataGrid Public Sub page_load(ByVal sender As Object, ByVal e As EventArgs) 
Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Inetpub\wwwroot\VOffice\Data\MayRR.xls;Extended Properties=Excel 8.0;" 
Dim objConn As New OleDbConnection(connstr) 'use $ sign when referencing the sheet in workbook 
Dim objadap As New OleDbDataAdapter("SELECT * FROM [agency_resid_auth$]", objConn) 
Dim ds As New DataSet() objConn.Open() 
'MayRR is excel workbook name 
objadap.Fill(ds, "MayRR") 
ExcelGrid.DataSource = ds.Tables(0).DefaultView 
ExcelGrid.DataBind() 
objConn.Close() 
End Sub 
#Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. 
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 
'CODEGEN: This method call is required by the Web Form Designer 
'Do not modify it using the code editor. 
InitializeComponent() 
End Sub #End Region End Class 
End Namespace