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

  • SEARCH
  • Home
  • 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 6951461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:13:22+00:00 2026-05-27T14:13:22+00:00

Say I have a windows service that runs a method to generate reports. For

  • 0

Say I have a windows service that runs a method to generate reports.

For example say I have a Reports table that has the report path, status, name of report, parameters etc.

When a user clicks the generate report button a new entry will be added to the table with a status of queued. The service will take queued reports, generate the report, update the status and set the path of the completed report.

The 2 ways I can think of doing this is to either poll the table for queued reports (something like):

TimerCallback callback = new TimerCallback(RunQuery);
this.QueryTimer = new Timer(callback, null, 1000, 10000);

public void RunQuery(object obj)
{                           
    //find reports with status of queued, 
    //loop through them and generate reports            
}

Or create a file with the ReportId and use a FileSystemWatcher to determine which reports to run (something like):

private void FileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
{
    ReportStack.Push(e.FullPath);
    Thread TR = new Thread(RunQuery);
    TR.Start();
}

public void RunQuery()
{                           
    string filePath = Convert.ToString(ReportStack.Pop()); 
    GenerateReport(filePath);
    ...
}

A downside to the 1st method is that I need to specify a poll time and reports don’t generate instantly as they are queued. A downside to the second method is the small hassle of creating and deleting files, setting up permission for the app to write to a shared folder etc.

Is there a way to get the service to automatically kick off reports as they are placed into the report table (something like a DatabaseTableWatcher!) or another better way to do this?

  • 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-05-27T14:13:22+00:00Added an answer on May 27, 2026 at 2:13 pm

    SQL triggers or Message Queuing

    http://msdn.microsoft.com/en-us/library/ms189799.aspx

    So when a record is inserted into the table you can fire off an action such as calling a sproc.

    Personally I like your first polling approach.

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

Sidebar

Related Questions

Say you have a Windows Mobile 6.0 phone that also has a GPS receiver.
I have a program that runs as a Windows Service which is processing files
Let's say I have two windows services running. One service is 'Polling' - it
Say I have some windows method and a struct: struct SomeStruct{ int foo; int
Let's say I have a standalone windows service running in a windows server machine.
Say I have a record in a table, and this record has a DATETIME
I have written a windows service in C# that essentially listens for commands on
I have an executable that is started by a windows service, this program will
I have a Windows Service that I am in the process of writing. I
I have a Windows Service that I install and upgrade with WiX, and this

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.