bbstat.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:3k
源码类别:
.net编程
开发平台:
C#
- 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.OleDb;
- using System.Configuration;
- using System.Text;
- namespace kuangren
- {
- /// <summary>
- /// bbstat 的摘要说明。
- /// </summary>
- public class bbstat : System.Web.UI.Page
- {
- protected int intRunTime;
- protected DateTime dtStartTime = DateTime.Now;
- protected System.Data.OleDb.OleDbCommand cmd3;
- protected System.Data.OleDb.OleDbConnection conn;
- protected System.Web.UI.WebControls.Repeater bbstat1;
- public DataSet dsPending;
- public string sql;
- public double sumone;
- public double sumtwo;
- public double sumthree;
- public double sumthree1;
- public string title;
- public int stat;
- public int Judgenum(int s1,int s2,int s3)
- {
- if (Convert.ToUInt32(Request.QueryString["action"])==1)
- {
- title="今日帖数";
- return s1;
- }
- if (Convert.ToUInt32(Request.QueryString["action"])==2)
- {
- title="主题数";
- return s2;
- }
- else
- {
- title="总帖数";
- return (s2+s3);}
- }
- private void Page_Load(object sender, System.EventArgs e)
- {
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- DataSet dspower = new DataSet();
- OleDbDataAdapter cmd3 = new OleDbDataAdapter("SELECT f2_topicnum,f2_replynum,f2_todaynum,f2_caption FROM forum_2 ORDER BY f2_id asc",conn);
- conn.Open();
- //Create and fill the DataSet.
- cmd3.Fill(dspower,"forum_2");
- //Create a second DataAdapter for the Titles table.
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- bbstat1.DataSource = dspower.Tables["forum_2"];
- Page.DataBind();
- //搜索所有发帖(各类)总和
- sql="SELECT sum(f2_topicnum) as sum1,sum(f2_replynum) as sum2,sum(f2_todaynum) as sum3 FROM forum_2";
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"forum_2");
- Page.DataBind();
- sumone=Convert.ToInt32(dsPending.Tables[0].Rows[0]["sum1"]);
- sumtwo=Convert.ToInt32(dsPending.Tables[0].Rows[0]["sum2"]);
- if (Convert.ToInt32(dsPending.Tables[0].Rows[0]["sum3"])!=0)
- {
- sumthree=Convert.ToInt32(dsPending.Tables[0].Rows[0]["sum3"]);
- sumthree1=Convert.ToInt32(dsPending.Tables[0].Rows[0]["sum3"]);
- }
- else
- {
- sumthree=1;
- sumthree=1;
- }
- conn.Close();
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }