im trying to write a automation program that scrape data from site and update it in database every few seconds.. and i ran into a problem,
This is my Code :
for (int i = 0; i < ips.Count; i++)
{
MySqlCommand command = con.CreateCommand();
command.CommandText = "INSERT INTO proxiestb (ip,port) VALUES (@ip,@port)";
command.Parameters.AddWithValue("@ip", ips[i].InnerText);
command.Parameters.AddWithValue("@port", ports[i].InnerText);
Console.WriteLine(ips[i].InnerText + ":" + ports[i].InnerText);
command.ExecuteNonQuery();
}
Its working but the problem is that i want to check for dulicate lines and remove it .. beacuse i want this for loop run agian and again every 2-3 minutes.. please help me to figure out what i need to add to my code in order to check for duplicates and then remove them before the loop run again , thanks.