Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:34:51+00:00 2026-06-13T16:34:51+00:00

Here is my problem , I am coding a C# application that will log

  • 0

Here is my problem , I am coding a C# application that will log in to a remote SQL server 2008 [Express edition to be precise] and fetch data from the database table (say foo) periodically[after each fetch the SQL client connection is closed ] .

How can I do this process periodically with a time interval like 60 seconds or so (user definable). ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:34:52+00:00Added an answer on June 13, 2026 at 4:34 pm

    Instead of System.Threading.Timer I’d use System.Timers.Timer which can be configured to be a “one shot” timer using the AutoReset property:

    System.Timers.Timer sqlTimer = new System.Timers.Timer();
    sqlTimer.Interval = 60000; // One minute
    sqlTimer.AutoReset = false; // Fire only once
    sqlTimer.Elapsed = TimerEvent; // Assign event for timer
    sqlTimer.Start(); // Start the timer
    

    In that case, as the timer fires only once, you don’t need to worry about locking or synchronization:

    private void TimerEvent(object source, ElapsedEventArgs e)
    {
        // Do your SQL-stuff
    
        // Restart the timer if you want
        sqlTimer.Start();
    }
    

    It must be noted that this timer as well runs in a separate thread, so the TimerEvent event will not be called in the context of the thread that created the timer. This is important to know in case you need to update any UI elements.

    Please note that this does not work for .NET Compact Framework, as it doesn’t know the System.Timers namespace – you’ll have to use Richard’s solution in that case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
I'm coding a email application that produces messages for sending via SMTP. That means
I have been coding an application which renders tiles and GUI and all that.
Im coding a social web application and Im having some problems. I will ask
I am writing an application for Android 2.3.5 (that will also be compatible with
Here's the scenario - I have a C# application that reads from a COM
My team is coding an application that involves editing wikipedia-like pages. It is similar
At the moment I'm coding a web application that imports image data from Google
I am creating an application that will handle and record when a student gets
So here is the problem. This application I have uses ODAC components but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.