I have two tables in a MySQL database and I am filling a DataTable for each table. I then am trying to compare them. I am not getting any errors, but it continues to run and after an hour I have no output so I'm wondering if there is a better way. Table 1 (masterlist) has around 250,000 records and table 2 has 17,000 records so there is alot to compare!
Master list (table 1) has all the records that is in table 2 (and even more) but they have different statuses (such as sold or whatnot) for some records and I want to look through them and find all that do not have a status of A. (All of table 2 has a status of A, so I want to find the records in table 1 that doesn't have status A which will indicate that I need to do something). Below is my loops.
For j As Integer = 0 To dt.Rows.Count - 1 ' Table 2 Used inventory to check. DataTable has two columns
Triomln = dt.Rows(j).ItemArray(0).ToString().Trim
For i As Integer = 0 To dt2.Rows.Count - 1 'Table 1 Total Inventory List (master list). Datatable has 2 columns
mln = dt2.Rows(i).ItemArray(0).ToString().Trim
strstatus = dt2.Rows(i).ItemArray(1).ToString().Trim
If mln = Triomln Then
If strstatus <> "A" Then
ListBox2.Items.Add(mln & " " & strstatus)