4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by sierrainfo
0

Use this..

u may get data from ur excelsheet

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim DBConnection = New OleDbConnection( _
         "Provider=Microsoft.Jet.OLEDB.4.0;" & _
         "Data Source=" & Server.MapPath("~/datame.xls") & ";" & _
         "Extended Properties=""Excel 8.0;HDR=Yes""")
        DBConnection.Open()

        Dim SQLString As String = "SELECT * FROM [Sheet2$] "
        Dim DBCommand = New OleDbCommand(SQLString, DBConnection)
        Dim DBReader As OleDbDataReader = DBCommand.ExecuteReader()

        GridView1.DataSource = DBReader
        GridView1.DataBind()
        DBReader.Close()
        DBConnection.Close()

    End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.