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.
I have no idea how to do this in Visual Studio VB, and need the easiest, shortest method to do this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One more thing..
Delete the following lines from my code if you use it
Imports System.Configuration.Confi gurationMa nager
Imports ClientEmail.StoredProcedur eCallerCla sses
They do not apply to the code.
Delete the following lines from my code if you use it
Imports System.Configuration.Confi
Imports ClientEmail.StoredProcedur
They do not apply to the code.
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/
http://www.janusys.com/controls/
Or you could try this
http://www.completit.com/Products/DGVE/Overview.aspx
http://www.completit.com/Products/DGVE/Overview.aspx
ASKER
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!
http://msdn.microsoft.com/en-us/library/xzb1zw3x(VS.80).aspx