哪位大侠给小弟讲讲asp.net中timer控件的用法啊 在视图设计里,拖如一个timer控件,双击timer控件图标,就会进入cs里,会自动生成一个方法,把你要处理的代码放到这个方法里就可以了 ,当然设好每次处理的间隔时间,在pageonload里,timer1.internal=30*1000(30秒),并且设timer1.enabled为true 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 asp.net中使用timer?那是不明智的想法!一般可能在要js里用settimeout http://blog.joycode.com/percyboy/posts/3595.aspx private void InitializeComponent() { this.timer1 = new System.Timers.Timer(); ((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit(); // // timer1 // this.timer1.Enabled = true; this.timer1.Interval = 1800000; this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed); this.Load += new System.EventHandler(this.Page_Load); ((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit(); } #endregion private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { SqlConnection SqlConn = new SqlConnection(ConfigurationSettings.AppSettings["strSqlConn"]); SqlConn.Open (); string strSql ="Update T_User Set point=point+1 where user_id=48"; SqlCommand myCommand = new SqlCommand(strSql,SqlConn); myCommand.ExecuteNonQuery(); SqlConn.Close(); }测试通过! asp.net中不能使用timer控件,上面的都是在winform中测试通过的代码,不能在webform中使用,littlehb(网际浪子) 讲的对,JavaScript实现 没用过,也没见过,只见过参数中的timer……___________________________________________学习中!!! oracle Float赋空值如何处理?现场等。 奇怪的问题,在线等.......... 求高人:如何将window.confirm的返回值回传给后台cs代码 多线程 VS2005的配置问题 一个关联列表的问题?请教高手!小弟在这先谢谢各位大哥了,在线等………… 新手急求,关于oracle中blob类型数据 求助asp.net制作贺卡系统实现分页 为什么Timer组件没效果? 请问,ASP.NET中如何解决获得表单提交数据乱码问题? web程序无法访问,请问iis的安全设置具体怎么弄?在线急等! 请教关于Asp.net中使用treeview控件的问题
{
this.timer1 = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1800000;
this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit(); }
#endregion private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
SqlConnection SqlConn = new SqlConnection(ConfigurationSettings.AppSettings["strSqlConn"]);
SqlConn.Open ();
string strSql ="Update T_User Set point=point+1 where user_id=48";
SqlCommand myCommand = new SqlCommand(strSql,SqlConn);
myCommand.ExecuteNonQuery();
SqlConn.Close();
}
测试通过!
___________________________________________
学习中!!!