C# - SSIS SQL stored procedure

I am calling a stored procedure in C# SCRIPT component in SSIS PACKAGE.

I want the result to exclude a particular row based on a field value. How can I accomplish this. I need help with the code.

I have something like this for now

while (sqlReader1.Read())    
          {

               
                  ResultSetBuffer.ColumnNamefromSPresult1 = sqlReader1["ColumnNamefromSPresult1"].ToString();
                   ResultSetBuffer.ColumnNamefromSPresult2 = sqlReader1["ColumnNamefromSPresult2"].ToString();
                   ResultSetBuffer.ColumnNamefromSPresult3 = sqlReader1["ColumnNamefromSPresult3"].ToString();
            }
                 

I want to exclude from the result set the row  where ColumnNamefromSPresult3 = "30"
lux satTechnical ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MlandaTCommented:
1 - why not do this from the SQL that is fetching there data from the database into the Reader?
2 - Below is a code sample. You need to check for NULLs (I'm checking for them and allowing them through here)
3 - You have perhaps taken out some code, but your loop is assigning values into the same variables... overwriting values from previous rows... just evaluate your use of a loop, otherwise, in the snippet you have posted, the looping is unnecessary
while (sqlReader1.Read())    
{

	if(sqlReader1["ColumnNamefromSPresult3"] == null || sqlReader1["ColumnNamefromSPresult3"].ToString() != "30") {
	
		ResultSetBuffer.ColumnNamefromSPresult1 = sqlReader1["ColumnNamefromSPresult1"].ToString();
		ResultSetBuffer.ColumnNamefromSPresult2 = sqlReader1["ColumnNamefromSPresult2"].ToString();
		ResultSetBuffer.ColumnNamefromSPresult3 = sqlReader1["ColumnNamefromSPresult3"].ToString();
	
	}

}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
What that Stored Procedure does? It has an exclude parameter that you can use to exclude rows with  ColumnNamefromSPresult3 = "30"?
lux satTechnical ConsultantAuthor Commented:
I've requested that this question be deleted for the following reason:

deleted
Vitor MontalvãoMSSQL Senior EngineerCommented:
deleted is not a valid argument to justify a question delete. Please explain better the reason that you want this question to be deleted.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.