Export Microsoft Access Data to Microsoft Excel using C#
Hi,
I am new here so I am not very sure where should i post my question to. Mod, please feel free to move this thread to the appropriate one. Thank you and sorry about it.
This is my scenario:
Usually companies use excel to store their data, for my company is like that. There is a lot of Excel files which makes it very messy and to worsened the situation, there are many similar files that contains some different header fields to each other. Since it is so complicated so i come up with the excel templates to centralize these files' headers.
There are in total 5 Excel templates so i link excel to access which access will be the database for that 5 files hence only need one database. When i do linking whatever i type in excel (The primary application for the staffs to enter data) such as insert/delete/modify any data, it will automatically update in access.
C# can only use access as data source (I think) so i sort of link Access to C#. I created windows forms, one of the form with buttons that when the user click on the button, the program will open the excel file that they want so that it will not be so troublesome for them to go and look for the repective files.
(My main problem)Another form is to generate the report. When the user click on the generate report button, an excel spreadsheet (.xls) will open up with the data and headers etc.
This is my logic/steps in doing it:
1) Open connection to Access
2) Create the select statement Eg: Select distinct EE ID From EE Data Order By Country
3) From the select statement, get the data from Access
4) Export the data based on the select statement and display it in Excel with the appropriate headers
Until now I could not find samples to do so hence please help me with this. Thank you so much.
If there are any examples available online, could you please post the link here?
Much appreciated. Thanks a lot!!