Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Searching error in Script Component SSIS

$
0
0

Hi,

I'm using a script Component to generate a new column in my table. I want to check if the "contactID" is in the "contact" table and generate a "statut" column that is boolean. The problem is the "statut" column is always FALSE. I think it's because the execution of the query is not working in the ProcessInputRow() method, i tried to execute it in the PreExecute() method withe a default parameter "contactID=3" and it's working fine. My problem is i don't know how debug a script component, I can't even use MessageBox in the ProcessInputRow() only in the PreExecute(). I need help please. Thanks

#My Code

public override void PreExecute()
{
        base.PreExecute();
       cmd = new System.Data.SqlClient.SqlCommand("SELECT ContactID FROM  Contact as ot WHERE ContactID =@mi", cn);
param = new System.Data.SqlClient.SqlParameter("@mi", SqlDbType.Int);
cmd.Parameters.Add(param);
}

public override void AcquireConnections(object Transaction)
{
base.AcquireConnections(Transaction);
cnManager = base.Connections.ConnexionADO;
cn = (SqlConnection)cnManager.AcquireConnection(null);
}

public override void Entrée0_ProcessInputRow(Entrée0Buffer Row)
    {
System.Data.SqlClient.SqlDataReader dtr;
cmd.Parameters["@mi"].Value = Row.ContactID;
dtr = cmd.ExecuteReader();


if (dtr.Read())
{
Row.statut = true;
}
else
{
Row.statut= false;
}


dtr.Close();
}


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>