Modifying the COM Component

Open up a standard COM VB Component that relates to the page you want to run the import from. See Create a COM Component for details of how to set up a VB Com Component.

Add the visual basic module generated on SQL Server see Generating the package for details. You will also need to add a reference to Microsoft DTSPackage Object Library
By default, this will have created a bas file with a sub main, you need to rename this subroutine and convert it into a function and make it accessible from main import class. I would suggest a meaningful name e.g. ImportData.

Add parameters to this module to allow the calling class to pass in details of the server, target file location and destination database
Modify the FailOnError property to be true
Modify each instance of the server name to be the parameter passed in through the procedure call
Modify each instance of the Initial Catalog connection properties for each table to be the variable passed in through the procedure call. Make the same change for the Catalog elements of the connection
Assuming you are using fixed files but a variable server location for the import files change each instance of the file path to the variable passed in.

Finally add an on error trap some meaningful error handling.
Last I would suggest adding a parameter which will allow you to set the package.logfilename to a file for testing purpose which you can then set through the asp and the calling class.
Alternatively Contact us for a quote

Home ] Up ]

Send mail to Webmaster with questions or comments about this web site.
Copyright©1999 SVEK Computing Ltd
Last modified: January 27, 2003