| | |
Comparing Two Datasets
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Solved Threads: 0
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())); }
}
}
}
}
}
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())); }
}
}
}
}
}
![]() |
Similar Threads
- Comparing Images For Similarity (Java)
- Validate the input date by comparing it with current year using Date function Date(Y) (PHP)
- comparing between 2 arrays (C++)
- Advanced : Reading Memory and Comparing (C)
- SAS help: comparing individual observations (Computer Science)
- Array or String Comparing Assignment (C++)
- Essay help:comparing two professions, Software Enginering and ? (Computer Science)
Other Threads in the VB.NET Forum
- Previous Thread: How to clear or refresh a combo box?
- Next Thread: Passing Parameters to Linked Subreports
| Thread Tools | Search this Thread |
.net 30minutes 2005 2008 access account arithmetic array basic bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog folder ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap survey table tcp temperature text textbox timer toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





