日期:2014-05-20  浏览次数:20609 次

静态访问量问题?高手请进~~~~~~
.cs页面如下:
using   System;
using   System.Collections;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Web;
using   System.Web.SessionState;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.HtmlControls;
using   System.Data.SqlClient;
using   System.Data.SqlTypes;
using   System.Data.OleDb;
using   System.Data.Odbc;
using   System.Data.Common;
using   System.Configuration;
using   System.Web.Security;
using   System.IO;
using   System.Text;
using   System.Net;

namespace   Counter  
{
///   <summary>
///   </summary>
public   class   _Counter   :   System.Web.UI.Page
{
Sicomm   scmm=null;
Sihansu   hasu=null;
public   string   fnid=null;
int   iDay=0,iMonth=0,iWeek=0,iViews=0;
private   void   Page_Load(object   sender,   System.EventArgs   e)
{
scmm=new   Sicomm();
hasu=new   Sihansu();
fnid=Request.Params[ "fnid "].ToString();
if(!Page.IsPostBack)
{
if(fnid!=null)
{
SiUpdateCount(fnid);
}

this.SiShowCount(fnid);
}

}
public   void   SiUpdateCount(string   fn)
{
try
{
string   sql= "select   WzViews,WzViewDay,WzViewWeek,WzViewMonth   from   SiWenz   where   WzID= "+fn;
DataSet   ds=hasu.ModifyRecord(sql, "SiWenz ");
if(hasu.ComputTable(sql)> 1)
{
DataRow   dr=ds.Tables[ "SiWenz "].Rows[0];
  iDay=Convert.ToInt32(dr[ "WzViewDay "].ToString());
iDay++;
  iWeek=Convert.ToInt32(dr[ "WzViewWeek "].ToString());
iWeek++;
  iMonth=Convert.ToInt32(dr[ "WzViewMonth "].ToString());
iMonth++;
  iViews=Convert.ToInt32(dr[ "WzViews "].ToString());
iViews++;


string   upsql= "update     SiWenz   set   WzViews= "+iViews+ ",WzViewDay= "+iDay+ ",WzViewWeek= "+iWeek+ ",WzViewMonth= "+iMonth+ "     where   WzID= "+fn;
hasu.sisan_comminserthout(upsql);
}ds.Clear();
}
catch
{
HttpContext.Current.Response.End();
}
}


public   void   SiShowCount(string   fn)
{
string   sql= "select   WzViews,WzViewDay,WzViewWeek,WzViewMonth   from   SiWenz   where   WzID= "+fn;

try
{
DataSet   ds=hasu.ModifyRecord(sql, "SiWenz ");
if(hasu.ComputTable(sql)> 1)
{
DataRow   dr=ds.Tables[ "SiWenz "].Rows[0];
Response.Write( "[   本日: "+dr[ "WzViewDay "].ToString()+ "   本周: "+dr[ "WzViewWeek "].ToString()+ "   本月: "+dr[ "WzViewMonth "].ToString()+ "   总浏览数: "+dr[ "WzViews "].ToString()+ "   ]   <span   OnClick= 'window.print(); '   style= 'cursor:hand '> [打   印] </span> ");
}
}
catch
{
    HttpContext.Current.Response.End();
}

}
#region   Web   窗体设计器生成的代码