This source used for Exporting data into To Excel ..
Just give referance and change few things .u get the result.
This one useful to both asp.net and vb.net.
Just sending parameters to procedure like datatable,filename ,filepath,column names.
Its creates the excel file data export into excel file and save into ur target folder.
' step 1: unzip the file
' step 2: copy the dll file into ur aplliction bin folder
' step 3: Give refernce to this .dll
' step 4: copy below code and paste into ur program, where u need this and do some modifications directory, filename..
Dim dad As New SqlClient.SqlDataAdapter("select * from authors", "server=localhost;user id=sa;password=;Initial catalog=pubs;")
Dim ds As New DataSet
Dim obj As New Hari_Export2Excel.NameSpace_Export2Excel.Class_Export2Excel
Dim filepath As String = "C:\TargetDirectory\" 'or server.mappath("../outputdirectory/")
Dim filename As String = "abc.xls"
dad.Fill(ds)
'' Sending Header Column Names
'Dim col() As String = {"COLUMN ONE", "COLUMN TWO", "COLUMN THREE"}
'obj.Export2Excel_By_Srihari(filename, filepath, ds.Tables(0), col)
' Default Column Names from database
obj.Export2Excel_By_Srihari(filename, filepath, ds.Tables(0), Nothing)
' Accessing File from saved Path
'Response.Redirect(filepath & filename)