hai, i have two datasets which contains table values.the process is to compare the two datasets (DS1 and DS2) whether its equal or not...help us plz...thanks in advance.

Try this.In my ex.both datasets contain one field each.For multiple fields you have to change code a bit.

     foreach (DataRow row in ds.Tables[0].Rows)
    {
        foreach (DataRow row1 in ds1.Tables[0].Rows)
        {
            if (row != row1)
            {
                if (ListBox1.Items.Count == 0)
                {
                    ListBox1.Items.Add(new ListItem(row.ItemArray.GetValue(0).ToString()));
                }
                else
                {
                    for (int i = 0; i < ListBox1.Items.Count; i++)
                    {



                            if (row.ItemArray.GetValue(0).ToString() != ListBox1.Items[i].Value)
                                if (i == ListBox1.Items.Count - 1)
                                { ListBox1.Items.Add(new ListItem(row.ItemArray.GetValue(0).ToString())); }




                    }
                }

            }
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.