Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

DTS with LoadFromSQLServer() - Invalid Class String error

Posted on 2007-10-21
6
Medium Priority
?
3,055 Views
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);
  package.Execute();

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: http://support.microsoft.com/?kbid=288910
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?
Thanks
Tracey

0
Comment
Question by:TVanNiekerk
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Julianva
ID: 20121086
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);
        }
    }
}

0
 

Author Comment

by:TVanNiekerk
ID: 20121138
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

0
 
LVL 8

Expert Comment

by:Julianva
ID: 20122619
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

0
 

Author Comment

by:TVanNiekerk
ID: 20128514
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.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 21091192
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

580 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