OH!
I should shame for this simple question, so I made it hard !
you can use your first code, the only thing is that you should define your variables in the class. like this:
/* Microsoft SQL Server Integration Services Script Component
* Write scripts using Microsoft Visual C# 2008.
* ScriptMain is the entry point class of the script.*/
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
int r= 0;
int s=0;
public override void PreExecute()
{
base.PreExecute();
/*
Add your code here for preprocessing or remove if not needed
*/
}
public override void PostExecute()
{
base.PostExecute();
/*
Add your code here for postprocessing or remove if not needed
You can set read/write variables here, for example:
Variables.MyIntVar = 100
*/
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
r = r + 1;
s = s + 1;
Row.dparent = "Novelis";
Row.dssn = Row.SSN;
if (!Row.HOMEPHONE_IsNull)
Row.dhome = Row.HOMEPHONE;
Row.daddr1 = Row.ADDRESSLINE1;
Row.daddrname = Row.ADDRESSLINE1;
Row.daddr2 = Row.ADDRESSLINE2;
Row.dcity = Row.ADDRESSCITY;
Row.dstate = Row.ADDRESSSTATE;
Row.dzip = Row.ADDRESSZIPCODE;
Row.dpartyUID = Row.SSN;
Row.difrowstat = Variables.ifrowstat;
Row.difrowbatchnum = Variables.ifrowbatchnum;
Row.difrowstatnum = s;
Row.drowid = r;
Row.dpartytypecd = Variables.partytypecd;
}
}
forgive me to confusing you on this issue .