a1jit Posted August 27, 2005 Posted August 27, 2005 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 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 Quote
*Experts* Nerseus Posted August 27, 2005 *Experts* Posted August 27, 2005 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 Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
a1jit Posted August 27, 2005 Author Posted August 27, 2005 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>? Quote
Joe Mamma Posted August 27, 2005 Posted August 27, 2005 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. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
a1jit Posted August 28, 2005 Author Posted August 28, 2005 (edited) 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... Edited August 29, 2005 by a1jit Quote
neodammer Posted August 30, 2005 Posted August 30, 2005 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. Quote Enzin Research and Development
bri189a Posted August 31, 2005 Posted August 31, 2005 I would use a trigger as Joe mentioned. That's your best bet. I'd consider anything else poor design. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.