1
我在Global.asax
中有大約10個應用程序變量計數器,用於顯示這10個不同類別的文件下載。現在我想在特定時間插入/更新這些計數器的值(由於應用程序重新啓動重置計數器時重置計數器)每天晚上11點說,並更新計數器。在當天的特定時間向SQL Server表插入/更新數據
怎麼辦?有任何想法嗎?
在Global.asax
:
void Application_Start(object sender, EventArgs e)
{
Application.Add("MGM",0);
Application.Add("PC",0);
Application.Add("NC",0);
Application.Add("TC",0);
Application.Add("PGC",0);
}
的shortCode
參數是全球性的會議從Global.asax
文件的名稱。我正在通過獲得櫃檯並相應增加。
在Download.aspx.cs
頁:
private int GetCount(string shordCode)
{
int count=0;
count = Convert.ToInt32(Application[shortCode]);
lock (Application[shortCode])
{
Application[shortCode] = ++count;
}
return count;
}
幫助感激..!
好的,謝謝我會試試... – 2012-08-11 10:14:53