Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
I am importing MS Access(2010/2007) database to MS Excel(2010/2007) in
i am able to export the data but column headers are not importing only data is coming.
1. Import with condition (Like from this date to this date Or by Name)
2. brows your destination and save data.
Thank you.
Posted 26-Nov-12 0:35am
Edited 26-Nov-12 17:56pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1[^]
Do change the code as per your requirements, Good Luck Smile | :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Look at this project,[^] it can export data from MS Access, sql server etc database, listview, command to ms excel, ms word, PDF, csv, MS access etc. Also, after you export data to excel,header and footer are also included in excel. you can also generate 15 types of charts in excel worksheets, set data format in excel and browse target file and save it.Hope it helps.
Dim connection As New OleDbConnection()
connection.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source="".\..\database\demo.mdb"";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False"
Dim command As New OleDbCommand()
command.CommandText = "select * from parts"
command.Connection = connection
Dim cellExport1 As New Spire.DataExport.XLS.CellExport()
cellExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
cellExport1.FileName = "sample.xls"
cellExport1.SQLCommand = command
santosh02 at 27-Nov-12 7:17am
Hi Tinier,
Dim cellExport1 As New Spire.DataExport.XLS.CellExport()
cellExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
spire is not declared and Spire.DataExport.XLS.CellExport is not declared
santosh02 at 27-Nov-12 9:50am
Its not possible tinier, Here i need to add spire.xls dll and spire.datexport dll files and if we add also its giving some error (error : change target framework .net 4.0 client version to .net 4.0)
Tinier at 27-Nov-12 21:11pm
after you add Spire.DataExport library, you can add the namespace to be
Import Spire.DataExport.TXT;
Import Spire.DataExport.XLS;
All these demos are in the downloaded Spire.DataExport. the path is Spire.DataExport\Demos\VB.
Tinier at 27-Nov-12 21:23pm
The above code is a simple one, if you want to know very clear about it, you can see it in demos in the downlaoded folder.
santosh02 at 28-Nov-12 4:23am
Thanks Tinier,
Its working fine...
and from above code data is getting saved in my connection string path. is it possible can i browse the destination and save?
Tinier at 28-Nov-12 21:09pm
yes, you can brows the target file and save it, actually, you also can set the data format,in the Spire.DataExport\Demos\VB\VBDemos-VS2010.sln, you can find the whole solution here.hope you good luck!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100