DTS with LoadFromSQLServer() - Invalid Class String error

Posted on 2007-10-21
Last Modified: 2013-11-30
Hi Experts!
I am in the processing of publishing my application to the server for testing. I am executing a DTS package from my code (web application .net C#):  SQL Server 2000 database is being used.

 Package2Class package = new Package2Class();
  package.LoadFromSQLServer( serverName.ToUpper(),
                     "username",     "userpw",   DTSSQLServerStorageFlags.DTSSQLStgFlag_Default,
                    null,    null,  null,   "DTS name",   ref pVarPersistStgOfHost);
  package.GlobalVariables.AddGlobalVariable("FileName", fileName);

However it fails when trying to execute the line 'package.LoadFromSQLServer()'. I have got this working on my local machine but when I publish it to the server I am get the following error::
Message: Invalid class string
Source: Microsoft Data Transformation Services (DTS) Package

I can execute the DTS Package in SQL Server 2000 with the user details and it works no problem.

I did find this KB article:
but am not too sure if it applies in my case. I say this as the server which this application is being run on has the following dll's registered on it:
dtsffile.dll,  dtspkg.dll, dtspump.dll, axscphst.dll
As far as I was aware these are the files only required for redistributing to allow DTS packages to be run.

This is all new to me so apologies if this is an simple query with a simple answer which I have missed. Any suggestions?

Question by:TVanNiekerk
    LVL 8

    Expert Comment

    C# example

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SqlServer.Dts.Runtime;

    namespace LoadFromSQLServerTest
        class Program
            static void Main(string[] args)
                // The variable, pkg, points to the location
                // of the ExecuteProcess sample installed with
                // the SSIS package samples.
                string pkg = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";
                Application app = new Application();
                Package loadedPkg = app.LoadPackage(pkg, null);

                // Save the package to SQL Server.
                app.SaveToSqlServer(loadedPkg, null, "yourserver", null, null);

                // The package can now be viewed in the
                // Microsoft SQL Server Management Studio, in the
                // Integration Services / Stored Packages / MSDB folder,
                // with a name of UsingExecuteProcess.
                Package pkgIn = new Package();
                pkgIn = app.LoadFromSqlServer("\\UsingExecuteProcess", "yourserver", null, null, null);
                DateTime pkgCreation = pkgIn.CreationDate;
                Console.WriteLine("Creation Date = {0}", pkgCreation);


    Author Comment

    Hi Julianva,
    Thanks for replying, I apologise for my ignorance but how would the above example resolve the "Invalid class string" Microsoft Data Transformation Services (DTS) Package error I am receiving when trying to execute this LoadSQLServer() command on the web server?

    I already have the DTS package saved in the SQL Server database under the: Data Transformation Services \ Local Packages.

    Thanks for your time / advice

    LVL 8

    Expert Comment

    have you used the name space in c# application

    using Microsoft.SqlServer.Dts.Runtime;
    namespace LoadFromSQLServerTest

    then make sure that the string is correct

    public Package LoadFromSqlServer (
        string packagePath,
        string serverName,
        string serverUserName,
        string serverPassword,
        IDTSEvents events


    Author Comment

    Hi Julianva,
    All my details were correct I was supplying were correct.
    However, I did get rid of the error "Invalid class string" by registering the CustTask.dll on the server I was running my web application from.
    Not too sure why or how as according to the Redist.txt file in SQL Server disk only the dtsfile.dll, dtspkg.dll, dtspump.dll and axscphst.dll need to be registered.

    Thanks very much for your input. Much appreciated.
    LVL 1

    Accepted Solution

    PAQed with points refunded (500)

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now