I'm working with DTS packages from within C#. Everything works i
development and testing, but when I move the application to
production server (an IIS box without SQL installed on the same box) i
throws:
COM object with CLSID {10020202-EB1C-11CF-AE6E-00AA004A34D5} is eithe
not valid or not registered.
Any ideas what needs to be registered, or is there a way to incorporat
the necessary file with my app so a registration is not required?
Here's the code:
// Execute the DTS on SQL Server to export the data
createAccessDB(strAccessDB, strCreateTableSQL);
string strSQLServerName
ConfigurationSettings.AppSettings["SQLServerName"];
string strSQLConnection
ConfigurationSettings.AppSettings["DBConn"];
string strSQLUserID
ConfigurationSettings.AppSettings["SQLUserID"];
string strSQLPassword
ConfigurationSettings.AppSettings["SQLPassword"];
Microsoft.SqlServer.DTSPkg80.Package2 package = ne
Microsoft.SqlServer.DTSPkg80.Package2Class();
UCOMIConnectionPointContainer CnnctPtCont
(UCOMIConnectionPointContainer) package;
UCOMIConnectionPoint CnnctPt;
PackageEventsSink PES = new PackageEventsSink ();
Guid guid = new Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5"); /
UUID of PackageEvents Interface
CnnctPtCont.FindConnectionPoint(ref guid, out CnnctPt);
int iCookie;
CnnctPt.Advise(PES, out iCookie);
object pVarPersistStgOfHost = null;
package.LoadFromSQLServer(strSQLServerName, strSQLUserID
strSQLPassword
Microsoft.SqlServer.DTSPkg80.DTSSQLServerStorageFl ags.DTSSQLStgFlag_Default
null, null, null, strDTSPackageName, ref pVarPersistStgOfHost);
foreach (Microsoft.SqlServer.DTSPkg80.GlobalVariable colGlobalVar
in package.GlobalVariables)
{
if (colGlobalVars.Name=="sServerName" |
colGlobalVars.Name=="sAccessDB" || colGlobalVars.Name=="UserID" |
colGlobalVars.Name=="Password")
{
package.GlobalVariables.Remove(colGlobalVars.Name) ;
}
}
try
{
package.GlobalVariables.AddGlobalVariable("sServer Name"
strSQLServerName);
package.GlobalVariables.AddGlobalVariable("sAccess DB"
strAccessDB);
package.GlobalVariables.AddGlobalVariable("UserID" , strSQLUserID);
package.GlobalVariables.AddGlobalVariable("Passwor d"
strSQLPassword);
package.AutoCommitTransaction=true;
package.WriteCompletionStatusToNTEventLog=true;
package.Execute();
package.UnInitialize();
package = null;
}
catch(System.Runtime.InteropServices.COMException ex)
{
...
}
catch(System.Exception ex)
{
...
-
robrichar
-----------------------------------------------------------------------
posted via www.WebFrustration.com