sir

I want to know how to call any exel sheet in asp.net

Recommended Answers

All 4 Replies

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

thank u sir this will helpme a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.