Visual CSharp .NET - Script Task

 
Vista:
sin imagen de perfil

Script Task

Publicado por alexis (59 intervenciones) el 21/06/2013 01:55:40
Buenas tardes que tal, hace un par de meses presento un error en el control Script Task, he investigado en internet probado suguerencias de pausas antes de ejecutar el task, tambien de cambio de correr el job en 32 bit, pero me siguie pasando el problema de aleatoriamente

estoy utilisando Integration Services, c # .net 2008 y base de datos Teradata
la cual dentro del codigo le hago referencia
using Teradata.Client.Provider;


el proceso puede durar dos horas, pasa el problema aleatorio este task esta dentro de un
Foreach Loop

este es parte del codigo y como estaba validando



/*
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
*/

using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Text;
using System.Net;
using System.IO;

using System.Collections.Generic;
using System.Xml;
using System.Data.Common;

using Teradata.Client.Provider;


namespace ST_e66e838a4e564bcb8909054803f88739.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{

#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion

/*
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.

To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);

To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";

Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.

To open Help, press F1.
*/

/// <summary>
///
/// </summary>
public void Main()
{


string ls_var1 = "";
string ls_var2 = "";
string ls_var3 = "";

Dts.TaskResult = (int)ScriptResults.Success;


if (Dts.Variables["v_var1"].Value != null)
{
ls_var1 = (string)Dts.Variables["v_var1"].Value;
}


if (Dts.Variables["v_var2"].Value != null)
{
ls_var2 = (string)Dts.Variables["v_var2"].Value;
}


if (Dts.Variables["v_var3"].Value != null)
{
ls_var3 = (string)Dts.Variables["v_var3"].Value;
}

//se llama al metodo
EnviarXMLWebService(ls_var1, ls_var2, ls_var3);

}


public void EnviarWebService(string p_ls_var1, string p_ls_var2, string p_ls_var3)
{

--------------------------
el cual me confunde si el error es dentro del metodo o si es dentro del llamado, ya que estoy validando a asignarle un valor a la variable si es distinto de null, entonces le asigno espacio en blanco


como dato en el project explorer me aparece con nombre de
st_b0c31036a89d4361b7b12220a219f6cb, eso fue porque copie y pege el task de otro, no se si eso tiene que ver tambien con el error

me manda el siguiente error,

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at ST_e66e838a4e564bcb8909054803f88739.csproj.ScriptMain.EnviarXMLWebService(String p_ls_var1 , String p_ls_var1, String p_ls_var1 )
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder