Several people have written the list, inquiring as to how they can execute a
SQL Server DTS Package from ColdFusion.  Here is the default syntax for the
object and it's methods in question (loading from either SQL Server,
Repository, or File), along with a (simple) code example.




Default Syntax to Create DTS Object:
<cfobject type="COM" name="myObjectName" class="DTS.Package"
action="CREATE">

LoadFromSQLServer Syntax:

ObjectName.LoadFromSQLServer("ServerName",
                "ServerUserName", 
                "ServerPassword", 
                "Flags", 
                "PackagePassword", 
                "PackageGuid", 
                "PackageVersionGuid", 
                "PackageName", 
                "pVarPersistStgOfHost")



LoadFromStorageFile Syntax:

ObjectName.LoadFromStorageFile("UNCFile", 
                "Password", 
                "PackageID", 
                "VersionID", 
                "Name", 
                "pVarPersistStgOfHost")


LoadFromRepository Syntax:

ObjectName.LoadFromRepository("RepositoryServerName", 
                "RepositoryDatabaseName", 
                "RepositoryUserName, 
                "RepositoryUserPassword, 
                "PackageID, 
                "VersionID, 
                "PackageName, 
                "Flags", 
                "pVarPersistStgOfHost")





if you want to retrieve the PackageGuid, PackageVersionGuid, PackageName
from the database, run the sp_enum_dtspackages system stored procedure.
it returns the following variables: name, id, versionid, description,
createdate, owner, size, packagedata, isowner 

Code to execute a DTS from ColdFusion ("objDTS" is the Object I created,
server is "shorwith", username is "sa" with no password, "test" is the name
of the DTS):

<CFTRY>
        <cfobject type="COM" name="objDTS" class="DTS.Package"
action="CREATE">
        <cfcatch type="Object">
                <CFSET error_message = "The DTS Package Object Could Not Be
Created">
        </cfcatch>
 </CFTRY>

 <CFSET r =
objDTS.LoadfromSQLServer("SHORWITH","sa","",0,"","","","test","")>
  
 <CFIF isDefined("error_message")>
        <cfoutput> #error_message# </cfoutput>
 </cfif>

 <CFSET p= objDTS.Execute()> 


Hope this helps out all of you who are (fortunate enough to be) calling DTS
packets from CF.

~Simon





-----Original Message-----
From: Jeff Sarsoun [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 02, 2000 3:18 PM
To: CF-Talk
Subject: accessing a dts file using cfobject


Has anyone created a dts file in MS SQL7 and was able to access it using
cfobject?  I am getting the error:

Error trying to create object specified in the tag.
COM error 0x800401F3. Invalid class string
The error occurred while processing an element with a general identifier of
(CFOBJECT), occupying document position (9:1) to (9:74) in the template file
c:\myfile.cfm

code:
<cfobject
Type="COM"
Action="create"
Class="DTS_NAME.DTS"
Name="dts_name">

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to