473,386 Members | 1,753 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,386 software developers and data experts.

Timer Control in APS.NET ?

HI,

i am using visual web developer for .net 2.0.

does .NET 2.0 comes with a timer control, i was unable to find it in
the IDE, where is it ?
thanks,
Abhishek

Mar 2 '06 #1
1 1406
Peter Bromberg posted this Rob Howard sample a few days ago :

using System;
using System.Web;
using System.Threading;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace BlackbeltBLL {
public class BackgroundService : IHttpModule {
static Timer timer;
int interval = 5000;
public String ModuleName {
get { return "BackgroundService"; }
}

public void Init(HttpApplication application) {
// Wire-up application events
if (timer == null)
timer = new Timer(new TimerCallback(ScheduledWorkCallback), application.Context, interval, interval);
}

public void Dispose() {
timer = null;
}

private void ScheduledWorkCallback (object sender) {
HttpContext context = (HttpContext) sender;
Poll(context);
}

void DoSomething (HttpContext context) {
}

#region DB Poll
void Poll (HttpContext context) {
SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["Northwind"]);
SqlCommand command = new SqlCommand("SELECT * FROM changenotification", connection);
SqlDataReader reader;
string key = ConfigurationSettings.AppSettings["SqlDependency"];
connection.Open();
reader = command.ExecuteReader();
while (reader.Read()) {
string tableKey = String.Format(key, reader["Table"]);
if (context.Cache[tableKey] != null) {
int changeKey = int.Parse( context.Cache[ String.Format(key, reader["Table"])].ToString() );
if (changeKey != int.Parse(reader["ChangeID"].ToString() ))
context.Cache.Remove(tableKey);
}
}
connection.Close();
}
#endregion
}
}

---000---


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<ab**********@hotmail.com> wrote in message news:11**********************@t39g2000cwt.googlegr oups.com...
HI,

i am using visual web developer for .net 2.0.

does .NET 2.0 comes with a timer control, i was unable to find it in
the IDE, where is it ?


thanks,
Abhishek

Mar 2 '06 #2

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

Similar topics

4
by: William Bub | last post by:
Is there an accurate way to create a "stopwatch" good to 1/10 of a second? I'm not sure if I should use the timer control, or some way to access the computer timer. I found the following site...
3
by: David | last post by:
Hi There! I'm using Timer control to record how long my application perform certain tasks. However, apparently Timer control is not doing its' job (i.e. Not firing Tick event) while my...
11
by: Steve Jorgensen | last post by:
I've recently been playing with some UI ideas that require the user of a timer to drive animation. The problem I'm having is that Access routinely stops firing timer events for long periods of...
5
by: Dhilip Kumar | last post by:
Hi all, I have developed a windows service using the windows service project template in VS.NET. I have used three controls in the service, a timer, performance counter and a message queue...
7
by: Noozer | last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is enabled, and that the interval is low (4000, which should be 4 seconds). To ensure the timer wasn't being inadvertantly...
2
by: vinay | last post by:
Hi I must be missing some obvious point, but can someone let me know how do I add a windows.forms.timer control to a form at run time Private TM as new windows.forms.time Dim sForm as for ...
7
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
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...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
3
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.