V
vinodkus
HI I m trying to display record from a excel sheet in gridview. It
does not show any error but when I run my defaut.aspx page shows
blank.
i m sending the program
Protected Sub Page_Load(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim str As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("ExcelData.xls") & ";" & "Extended
Properties=Excel 8.0;"
Dim objConn As New OleDbConnection(str)
objConn.Open()
Dim objCmdSelect As New
OleDbCommand("select * from MyRange1", objConn)
Dim objAdapter1 As New OleDbDataAdapter()
objAdapter1.SelectCommand = objCmdSelect
Dim objDataSet1 As New DataSet()
objAdapter1.Fill(objDataSet1, "XLData")
GridView1.DataSource =
objDataSet1.Tables (0).DefaultView
GridView1.DataBind ()
objConn.Close()
End If
End Sub
vinod is virtual directory, website is folder inside
it and exceldata.xls is a excel file in website folder
what error can be can u tell?
if do u know plz tell me?
does not show any error but when I run my defaut.aspx page shows
blank.
i m sending the program
Protected Sub Page_Load(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim str As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("ExcelData.xls") & ";" & "Extended
Properties=Excel 8.0;"
Dim objConn As New OleDbConnection(str)
objConn.Open()
Dim objCmdSelect As New
OleDbCommand("select * from MyRange1", objConn)
Dim objAdapter1 As New OleDbDataAdapter()
objAdapter1.SelectCommand = objCmdSelect
Dim objDataSet1 As New DataSet()
objAdapter1.Fill(objDataSet1, "XLData")
GridView1.DataSource =
objDataSet1.Tables (0).DefaultView
GridView1.DataBind ()
objConn.Close()
End If
End Sub
vinod is virtual directory, website is folder inside
it and exceldata.xls is a excel file in website folder
what error can be can u tell?
if do u know plz tell me?