I've got a while loop that works well if the messagebox is active.
But withouth the messagebox there loses 1 item each time i run this code...
The stats.add:
strange isn't it?
But withouth the messagebox there loses 1 item each time i run this code...
Code:
int aantal,teller;
aantal = betalingscondities.Rows.Count;
teller = 0;
while ((aantal-1) > teller) {
//MessageBox.Show(betalingscondities.Rows[teller].Cells[1].Value.ToString());
stats.add_conditie(betalingscondities.Rows[teller].Cells[1].Value.ToString());
Application.DoEvents();
teller = teller + 1;
}
The stats.add:
Code:
public void add_conditie(string item)
{
try
{
OleDbConnection Connection = new OleDbConnection();
Connection = dbase(Connection);
// Create an OleDb command,
OleDbCommand command = new OleDbCommand();
command.Connection = Connection;
command.CommandText = "insert into betalingscondities(conditie) values('" + item + "')";
command.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}
strange isn't it?