473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Timer not beeing called.


Hello,

I have a timer in my webservice. But the timer as follow:

private void InitializeComponent()

{

this.timer1 = new System.Timers.Timer();

((System.ComponentModel.ISupportInitialize)(this.t imer1)).BeginInit();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 3600000;

this.timer1.Elapsed += new
System.Timers.ElapsedEventHandler(this.timer1_Elap sed);

((System.ComponentModel.ISupportInitialize)(this.t imer1)).EndInit();

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if(disposing && components != null)

{

components.Dispose();

}

base.Dispose(disposing);

}
#endregion

private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)

{

DataSet
ds=SqlHelper.ExecuteDataset(Global.GetConnectionSt ring,CommandType.Text,"select
* from Job");

this.Jobs=ds.Tables[0];

//this.JobsCopy= new DataTable();

//JobsCopy.
}

How do i make sure this routine is executed every hour?

Thanks

JB
Nov 23 '05 #1
3 1861
"jensen bredal" <je***********@yahoo.dk> wrote in
news:OF**************@TK2MSFTNGP09.phx.gbl:
I have a timer in my webservice. But the timer as follow:

How do i make sure this routine is executed every hour?


Timers rely on windows messages, also you dont say where your timer is, bt if
its on the webservice asmx, it will get destroyed before it fires.

You can create a thread in a static constructor have have the thread sleep
and fire an event.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 23 '05 #2
My timer resides in the asmx file.
could you provide some example.

Yeah i agree , programming fights back.

Nov 23 '05 #3
"jensen bredal" <je***********@yahoo.dk> wrote in news:#NJMaPZVFHA.3696
@TK2MSFTNGP10.phx.gbl:
My timer resides in the asmx file.
It wont work then for the reasons I stated.
could you provide some example.
Im sorry but I cant - I just dont have time to write code examples. Look up
threads, then create one in a static constructor.
Yeah i agree , programming fights back.


Very much so. :)
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christine | last post by:
I've implemented a countdown timer for a tutorial web page that should give the user 45 minutes to complete the test, only to find that the timer is slowly 'losing' time. On average, it actually...
3
by: Peter Johnsson | last post by:
How come the eventhandler for the timer's elapsed time event is called over and over again, even though the AutoReset property is set to false, if you assign a new value to the timer objects...
8
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
5
by: Michael C# | last post by:
Hi all, I set up a System.Timers.Time in my app. The code basically just updates the screen, but since the processing performed is so CPU-intensive, I wanted to make sure it gets updated...
6
by: Michael C | last post by:
I've created a timer object and set it running without keeping a reference to it and not stopping it. Shouldn't the garbage collector pick up that there's no reference to the timer, call finalize...
4
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this...
10
by: ttl_idiot | last post by:
I think this is a C++ question, but you might think its basic: How can I in a c++ environment let b when used as an r-value, as in a = b; // where a is declared as int mean that a...
4
by: jwriteclub | last post by:
Hello all, I have a quick question about timers in C#. I have a System.Windows.Forms.Timer timer (the kind you "drag" out of the toolbox. It looks something like this: public class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.