Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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

"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
Posted

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>?

Posted
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.

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.

Posted (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 by a1jit

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...