Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving an exported file to a sql server database

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Using the RDC, I have generated a crystal report and then exported it to a word doc, but i want to save it direct to a database and not save it to a file path. Can any one help with some sample code.

Cheers

Gaz
 
You can export to an ODBC DSN. Here is some code to export to Access. It will need some small changes for SQL Server or Oracle (like username/password properties. Also the user would need the privilege (in SQL Server or Oracle) to create a new table. I don't believe that the export can append to a table.

Assuming your report object is called Report1 and you've logged onto the server, etc.

Dim crystalExportOptions As ExportOptions

Set crystalExportOptions = Report1.ExportOptions
crystalExportOptions.ODBCDataSourceName = "Crystal Test"
crystalExportOptions.ODBCDataSourceUserID = "admin"
crystalExportOptions.ODBCExportTableName = "MyNewTable"
crystalExportOptions.DestinationType = crEDTDiskFile
crystalExportOptions.FormatType = crEFTODBC
Report1.Export False
Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top