Click here to Skip to main content
15,914,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dataset ds1 have table ,attributes ( id,name, status)

I need to copy frm ds1 to ds2 ,these rows field 'status' must =1
I used directcopy () ,But how to select particular rows only
Posted
Comments
Andrew Rissing 4-Jun-10 10:23am    
Why are you posting an answer to your own question, especially so quickly after you've posted it?

1 solution

A simple solution is.

Here Dataset ds2 contains all data, we can select required row by use for loop.
sendmail is a string variable.Same as assign to any dataset tables.
C#
for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
        {
            if (ds2.Tables[0].Rows[i]["status"].ToString() == "Open")
            {
                sendmail += ds2.Tables[0].Rows[i]["Expr1"].ToString();
            }
        }
 
Share this answer
 
Comments
Andrew Rissing 4-Jun-10 10:24am    
Reason for my vote of 2
You are not solving the original intent of your own question...?!? Furthermore, you're not doing it in a performance friendly way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900