哪位大侠给小弟讲讲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……___________________________________________学习中!!! 数据类型 这是VS2010的问题还是IE的问题 帮帮忙,答对立刻结贴给分 新做的几个网站页面,大家评价下 帮忙修改一个onmouseover CuteEditor中无法保存空格,急!! 页面中有一组单选按钮,怎样VB代码选择其中的一个? 初学,郁闷了一天了,请帮忙看一下吧 asp.net 页面跳转时如何不刷屏 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();
}
测试通过!
___________________________________________
学习中!!!