jianinclude5.ascx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:3k
源码类别:
.net编程
开发平台:
C#
- namespace kuangren
- {
- 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;
- /// <summary>
- /// jianinclude5 的摘要说明。
- /// </summary>
- public class jianinclude5 : System.Web.UI.UserControl
- {
- protected System.Data.OleDb.OleDbCommand cmd3;
- protected System.Data.OleDb.OleDbCommand cmd4;
- protected System.Data.OleDb.OleDbCommand cmd5;
- protected System.Data.OleDb.OleDbConnection conn;
- protected System.Web.UI.WebControls.DataList userpower;
- public int showpower;
- public int showpower2;
- public string GetPath1(object o)
- {
- if ((string)o == "1")
- return "admin_1.gif";
- if ((string)o == "2")
- return "admin_2.gif";
- if ((string)o == "42")
- return "guest_1.gif";
- else
- return "user_1.gif";
- }
- public string judgeguest(object homepage)
- {
- if ((string)homepage== "客人")
- return ""+homepage+"";
- else
- return "<a href=user_infor.aspx?u_user="+homepage+" target=_blank>"+homepage+"</a>";
- }
- 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 * from online order by startime desc",conn);
- OleDbCommand cmd4 = new OleDbCommand("select count(id) from online where username='客人'",conn);
- OleDbCommand cmd5 = new OleDbCommand("select count(id) from online where username<>'客人'",conn);
- conn.Open();
- showpower=(int)cmd4.ExecuteScalar();
- showpower2=(int)cmd5.ExecuteScalar();
- //Create and fill the DataSet.
- cmd3.Fill(dspower,"online");
- //Create a second DataAdapter for the Titles table.
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- userpower.DataSource = dspower.Tables["online"];
- Page.DataBind();
- 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
- }
- }