Loop every 10 minutes then continue after 20 minutes

a1jit

Regular
Joined
Aug 19, 2005
Messages
89
Hi Guys,

Is there any way to loop a database every 10 minutes..then wait for some time and continue again..

Is timer a good idea? will it take a lot of memory to do this?

I know this api function

Code:
Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Private Sub form load()

Do While "some condition"
    "Your code Here"
    Sleep 10000
Loop

End Sub

Which is better..this api or timer?

And another question, this api i used in visual basic..how to convert it so that it works in c#?

Thank you very much
 
If it works for you, I'd probably use Sleep - not sure what you're doing every 10 minutes though, so it's hard to give good advice.

You don't need the API to sleep, it's exposed for you:
System.Threading.Thread.Sleep(TimeSpan.FromMinutes(10.0))

There's an overload to pass in milliseconds if that's more your thing.

-ner
 
Actually im loopinng the dayabase and looking for some changes ... if there is change, i want to send out email or something...

So is it a good idea to use a timer here...i takes lots of memory>?
 
a1jit said:
Actually im loopinng the dayabase and looking for some changes ... if there is change, i want to send out email or something...

So is it a good idea to use a timer here...i takes lots of memory>?
what db are you using????

A real database like SQL Server/Oracle/Firebird/Sybase/DB2???

use databased triggers and the database's native mail utility.
 
Hi,

So how can i loop a procedure then stop for 10 minutes, then loop again..
I have a code from msdn, it runs procedure every 600 milliseconds until a loop has finished..

But the problem im facing is the 'loop' part of my code does not complete in 600miliseconds, sometimes longer and sometimes faster,

So is the any way i can loop a procedure, after it finish,sleep for 10minutes, then start again...
 
Last edited:
Im guessing the timer control? its a loop in itself and can be easily manipulated for that condition..if im thinking i understand you correctly.
 
I would use a trigger as Joe mentioned. That's your best bet. I'd consider anything else poor design.
 
Back
Top