i have one list and one database. The list is made after i've decided a number in a numbericUpDown. So for an example i can get the list
fj1Section:
1
34
33
32
31
20
19
18
17
16
each of this sections exists in the database in the 2. column.
And in the database, each section have a date.
i wan't to find out what's row in the database have the oldest date and the section needs to be the same as one number in my list.
i've made it a little easier in the connection queri, to make the database descending by the date, so it would be enough to check the first item in the database and check if the section number is the same, if not, go to next row.
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
for (int i = 0; i < fj1Sections.Count; i++)
{
while (reader.Read())
{
string section_no = reader[1].ToString();
if ((section_no == fj1Sections[i].ToString())
{
//result;
richTextBox1.Text = "Sekction: " + fj1Sections[i].ToString();
}
}
}
I've wrote this code, but it just check the first number in the list and find the date for this section, but most likely, it's not the oldest one.
Any help?