Comparing Two Datasets

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 32
Reputation: karan_21584 is an unknown quantity at this point 
Solved Threads: 0
karan_21584 karan_21584 is offline Offline
Light Poster

Comparing Two Datasets

 
0
  #1
Apr 6th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1
Reputation: nrar is an unknown quantity at this point 
Solved Threads: 0
nrar nrar is offline Offline
Newbie Poster

Re: Comparing Two Datasets

 
0
  #2
Mar 27th, 2008
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())); }




}
}

}
}
}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC