ASP.net中Timer和WebService的使用
示例一
在Global.asax.cs文件中:
protected void Application_Start(Object sender, EventArgs e)
{
System.Timers.Timer timer1 = new System.Timers.Timer();
timer1.Interval = 50000; // 50000 毫秒 = 50秒
timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Elapsed);
timer1.AutoReset = true;
timer1.Enabled = true;
timer1.Start();
}
void timer1_Elapsed(object source, System.Timers.ElapsedEventArgs e)
{
// 在这里加上读取数据库的代码就可以实现后台服务定时访问数据库的功能,该功能对于实现文件解
//锁、论坛定时统计等很有用。
}
示例二
通过在网站的Global.asax的Application_Start方法中
加入定时器 定时调用WebService
该WebService的一个方法 负责在后台
向数据库的某个表加入数据
步骤:
1.通过VS 新建一个网站
2.加入Global
相关文档:
首页:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......
1 ASP.NET 服务器控件GridView使用
本教程不介绍服务器端控件的呈现,事件处理,状态等理论知识,只介绍服务器端控件的使用操作,如果您对服务器控件的知识感兴趣,请参阅《ASP.NET服务器控件高级编程》
阅读本文时最好和 文档 《ASP.NET服务器控件使用之Grid ......
/// <summary>
/// 得到站点用户IP
/// </summary>
/// <returns></returns>
public
static
string
getUserIP()
{
retu ......
1、类是引用类型,结构则是值类型。因此结构是放在栈(Stack)里,类则仅仅是将引用地址存放在栈里,而具体的值则存放在堆(heap)里。
2、据第1点可以得出结论,那就是类对象通常用来传递大数据,而结构对象则用来传递小数据。
3、类可以继承和被继承,而结构则不支持。但结构和类一样可以继承自接口。
4、结构对象不能 ......