易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

asp.net链接Access数据库字符串正确方法

在web  config中  作如下配置:
<connectionStrings>
    <add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
 
  </connectionStrings>
在.net文件中应用链接 ......

Asp.net页面传递参数的几种方法对比讲解

第一种方法:
通过URL链接地址传递
send.aspx:
   protected void Button1_Click(object sender, EventArgs e)
     {
         Request.Redirect("Default2.aspx?username=honge");
     }
receive.aspx:
string user ......

ASP.NET服务器控件使用之GridView

1         ASP.NET 服务器控件GridView使用
本教程不介绍服务器端控件的呈现,事件处理,状态等理论知识,只介绍服务器端控件的使用操作,如果您对服务器控件的知识感兴趣,请参阅《ASP.NET服务器控件高级编程》
阅读本文时最好和 文档 《ASP.NET服务器控件使用之Grid ......

How postback works in ASP.NET

Introduction
In this article, we will take a closer look at how ASP.NET pages post back to themselves, and how to customize this feature in our web applications.
function __doPostBack(eventTarget, eventArgument)
One of the most important features of the ASP.NET environment is the ability to decla ......

ASP.NET 实现多版本語言

public class PageBase:System.Web.UI.Page
{
 public PageBase()
 {
  //
  // TODO: Add constructor logic here
  //
 }
    protected override void InitializeCulture()
    {
        // ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号