I have a dtspackage which is executed through the C# coding.Earlier we have used sql server 2008 r2, Now we have moved to sql server 2012. The package was working fine with sql server 2008 while executing through C#code.But now while loading the Config file it throwing the exception like **
Microsoft.SqlServer.Dts.Runtime.DtsTaskException was caught
Message=Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) Source=Microsoft.SqlServer.DTSRuntimeWrap
ErrorCode=-2147352571 StackTrace: at Microsoft.SqlServer.Dts.Runtime.Package.ImportConfigurationFile(String str)
**
public bool ExecuteDtsService()
{
bool retval = false;
StringBuilder strBldrErrorMsg = new StringBuilder();
Package pkg;
Application app= new Application();
DTSExecResult pkgResults;
ExecuteDTSEventListener eventListener = new ExecuteDTSEventListener();
try
{
String pkgLocation = objProcess.SSISFilePath + pathSpecifier + objProcess.JobName;
String pkLocationDtsConfig = objProcess.ConfigFilePath + pathSpecifier + objProcess.ConfigeFileName;
pkg = app.LoadPackage(pkgLocation, null);
pkg.ImportConfigurationFile(pkLocationDtsConfig); //getting error here
pkgResults = pkg.Execute();
if (pkgResults.ToString().Equals("Success"))
{
retval = true;
}
else if (pkgResults.ToString().Equals("Failure"))
{
foreach (DtsError local_DtsError in pkg.Errors)
{
strBldrErrorMsg.Append(local_DtsError.Description.ToString());
}
ReadLog(strBldrErrorMsg.ToString());
}
return retval;
}
catch(Exception ex)
{
objUtility.WriteLogFile(ex, "ExecuteDTSservice");
return retval;
}
}
The DTS package will download the xml content and transform to table.And it download one excel file and fetch the data from the excel.
The package running successful when i execute through the Execute Package Utility
Please guide me to fix the issue.
Thanks In Advance
User contributions licensed under CC BY-SA 3.0