Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

Timer not beeing called.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jensen bredal - 10 May 2005 12:22 GMT
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.timer1)).BeginInit();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 3600000;

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

((System.ComponentModel.ISupportInitialize)(this.timer1)).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.GetConnectionString,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
Chad Z. Hower aka Kudzu - 10 May 2005 16:50 GMT
> 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
jensen bredal - 10 May 2005 20:09 GMT
My timer resides in the asmx file.

could you provide some example.

Yeah i agree , programming  fights back.
Chad Z. Hower aka Kudzu - 10 May 2005 21:53 GMT
"jensen bredal" <jensen.bredal@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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.