Israel

Israel

  • 705
  • 1.3k
  • 216.4k

How to stop a loop when its the end of database

Aug 2 2017 6:14 PM
Hi!
 
With these codes its making a loop. But the problem is its displaying the record into combobox until the last record of my dababase. But later this work its doesnt stop. Its sound making the loop without stop. I have to stop it manually because with the exit button its doesnt stop:
 
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\BlessFive\BlessFive\App_Datas\blessfive.mdb;Persist Security Info=False");
con.Open();
OleDbCommand cmd = new OleDbCommand("select numbers from Receive_Numbers_To_Send", con);
OleDbDataAdapter SDA = new OleDbDataAdapter();
SDA.SelectCommand = cmd;
DataTable DT = new DataTable();
SDA.Fill(DT);
cbxSMSSending.DataSource = DT;
con.Close();
Application.DoEvents();
ia++;
int milliseconds = 2000;
Thread.Sleep(milliseconds);
//button6.PerformClick();
//btnEnvoiSMS_PrincipalEntry.PerformClick(); //Trigger click event
//btnAffiche.PerformClick();
 

Answers (9)