C# script in Sql Server Integration servcies Script Component to copy data

Posted by Sriharim under C# on 5/6/2015 | Points: 10 | Views : 360 | Status : [Member] | Replies : 0
I want to identify null data in eid,firstname,did columns. Also, to find the which column has null value and to save the below converted integers(s and p variable) into new columns.

In below code, columns are: eid, did, firstname,lastname, ss,pp, problem, Ifgood.

Here problem is, i am unable to copy the s and p variable data into ss and pp columns.
That is : s = Convert.ToInt32(Row.eid);
Row.ss = s;
After executing below code, the data in ss and pp columns is 0.
eid,did,firstname,lastname has data in the columns.

Entire code is:

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
if (Row.eid_IsNull || Row.FirstName_IsNull || Row.DID_IsNull)
{
Row.Problem = "At least one column is not filled in";
Row.Ifgood = false;
return;
}
else
{
Row.Ifgood = true;
return;
}
// try to convert eid/did numbers to integers

int s = 0;
int p = 0;
try
{
s = Convert.ToInt32(Row.eid);
Row.ss = Convert.ToInt32(Row.eid);
}
catch
{
s = 0;
}
try
{
p = Convert.ToInt32(Row.DID);
Row.pp = Convert.ToInt32(Row.DID);
}
catch
{
p = 0;
}
// if either still 0, we couldn't convert
if (s == 0 || p == 0)
{
Row.Problem = "The Eid and Did numbers aren't both integers";
Row.Ifgood = false;
return;
} }


please help me in C# script, how to copy converted data of eid and did into ss and pp columns .

---
Srihari



Responses

(No response found.)

Login to post response