Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Export Recordset to Excel File
Message
De
07/01/2001 09:01:01
 
 
À
07/01/2001 08:11:49
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00460308
Message ID:
00460310
Vues:
10
>How Can I export a recordset to Excel file using ADO.
>

Therte's no 'export' per se from ADO; the easiest mechanisms would be to either create a .CSV (comma-sparated values, a type of comma delimited text file) from the ADO recordset and use Excel to import it, populate the Clipboard with the content of the recordset and use Excel automation to paste the clipboard into an appropriate spreadsheet, or use Excel automation to populate an Excel spreadsheet cell-by-cell. It should be possible to create another ADO recordset based on the Excel OLEDB provider, and populate the new Excel-based ADO recordset from the original ADO recordset, but I've never tried this and don't have any idea of exactly what you'd need to do to set up the target worksheet via ADO and populate it, but it's going to be at least as involved as the other approaches. The first approach is easiest; the second is going to be the faster approach to creating a .XLS directly from an ADO recordset for larger amounts of data, since it requires fewer calls to Excel automation, and the third provides the most direct control over the exact creation of the spreadsheet and does not require a template spreadsheet to be created before performing the export. Both the second and third techiques require that Excel has been installed on each workstation, since they rely on using the Excel automation model in the application code.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform