But while running the code Application got crashed.I saw event viewer and found below exception in event viewer
Faulting module name: DTS.dll, version: 2009.100.1600.1, Exception code: 0xc0000005
Faulting module path: C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTS.dll.
When I run my c#application to execute the pacakge see code below:
public DTSExecResult ExecutePackageFromFile(string packageName, IDictionary<string, object> variablesMap, out Package pkg)
{
Application app = new Application();
pkg= app.LoadPackage(packageName, null,true);
//set package varaibles
Microsoft.SqlServer.Dts.Runtime.Variables vars = pkg.Variables;
IEnumerator<KeyValuePair<string, object>> varEnumarators = variablesMap.GetEnumerator();
while (varEnumarators.MoveNext())
{
KeyValuePair<string, object> item = varEnumarators.Current;
{
vars[item.Key].Value = item.Value;
}
//This line crashes the application
return pkg.Execute();
}
Note: Package gets executed if I don't use any sql command as expression.But application gets crashed when I use expression in pacakge and gives above Faulting module error.
Please help me.