Click here to Skip to main content
15,888,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public DataTable advancesearch1(DataTable ds, DataTable dl)
    {
        DataTable ff = new DataTable("ff");


        ff.Columns.Add("postid", typeof(string));


        for (int i = 0; i < ds.Rows.Count; i++)
        {
            for (int j = 0; j < dl.Rows.Count; j++)
            {

                if (ds.Rows[i]["postid"].ToString() == dl.Rows[j]["postid"].ToString())
                {

                    DataRow drow = ff.NewRow();
                    drow["postid"] = ds.Rows[i]["postid"].ToString();
                  
                    ff.Rows.Add(drow);
                    
                }
            }
        }

        return ff;
       

    }

this is code for two data tables... i want more datatables in one loop
Posted
Updated 22-Feb-12 18:34pm
v2
Comments
Varun Sareen 23-Feb-12 4:09am    
in which loop you want another datatable? Please elaborate a little more on this
sujith@88 23-Feb-12 4:44am    
want to compare a group of datasets...
public DataTable search(Dataset[] data)
{
?
//return the same values in the datasets
}
[no name] 23-Feb-12 4:35am    
Do you at least understand what the code does?

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