Hello my friends:
I am getting the row count from a database and assigning it to a variable. I need to run or call otherClasses
and Methods
from the Main Method
of aConsole App
based on the value assigned to the variable from the database.
Here are the steps:
- Check the variable, if it is greater than zero
- Run the code inside the main method
- Then wait for X seconds using timer
- After X seconds, check the variable again and if it is still greater than zero, run and wait again.
- Finally, if the variable is equals zero, exit the console.
What I do not know is how to repeat the wait and execute.
The following code i an example, however: I need the program to stop at each interval.
{
int intCheckRowCount = Database.DataExists();
while (intCheckRowCount > 0)
{
intCheckRowCount = Database.DataExists();
//Run Code Here
//Then Wait
Thread.Sleep(20000);
}
}