Link to home
Start Free TrialLog in
Avatar of leevee1606
leevee1606

asked on

Import / Export Excel Spreadsheets into and from datasets using Visual Studio 2008 VB9

I have a VB9 / Visual Studio 2008 application, which uses a .mdb database. I select data from the database with a  select button using an sql statement so that it shows only selected data in the grid on screen. I then have the option to print just that selected data. I now need to add the option to export just the selected data to an excel spreadsheet. Similarly, I also need the option to import from the same  spreadsheet that was previously created by the above process, into that selected dataset, so that it only updates the records present in the selection.
I have no idea how to do this in Visual Studio VB, and need the easiest, shortest method to do this.
ASKER CERTIFIED SOLUTION
Avatar of JasonChandler
JasonChandler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JasonChandler
JasonChandler

Ok just reread your question, If you use the ReadExcelFileToDataSet Method in my code you can load the sheet data into a dataset, from there you can save the changes in the dataset. See this link for help, or maybe somebody else can give you the code, I am really busy at present. I can look at this later however, but cant promise when, sorry.
http://msdn.microsoft.com/en-us/library/xzb1zw3x(VS.80).aspx
One more thing..
Delete the following lines from my code if you use it
Imports System.Configuration.ConfigurationManager
Imports ClientEmail.StoredProcedureCallerClasses
 They do not apply to the code.
Avatar of leevee1606

ASKER

Thanks for that, Jason - will try the code shortly. Just one question - you said you have a grid that allows you to export data - how do you set up a grid to allow you to export data?
Hi I did not set up the Grid I bought a 3rd party one:
http://www.janusys.com/controls/
Thanks Jason - after much fiddling , managed to get it going using your code as a base. And the export side was easy - I wasn't thinking - crystal reports has a built-in export function, so I just created a report and export to excel from there. Anyway, thanks for the code which helped me get the import side going!