user_infor.aspx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:4k
源码类别:
.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>
- /// user_infor 的摘要说明。
- /// </summary>
- public class user_infor : System.Web.UI.Page
- { protected int intRunTime;
- protected DateTime dtStartTime = DateTime.Now;
- protected System.Data.OleDb.OleDbCommand cmd;
- protected System.Data.OleDb.OleDbCommand cmd1;
- protected System.Data.OleDb.OleDbCommand cmd2;
- protected System.Data.OleDb.OleDbCommand cmd3;
- protected System.Data.OleDb.OleDbCommand cmd4;
- protected System.Data.OleDb.OleDbConnection conn;
- protected System.Web.UI.WebControls.Repeater userarticle;
- protected System.Web.UI.WebControls.Repeater userpower;
- public DataSet dsPending;
- public string sql;
- public float upostdel;
- public int showarticle;
- public string norecord;
- public int showpower;
- public string nopower;
- public string usercookies;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.Cookies["jusername"]!=null)
- {
- usercookies=Request.Cookies["jusername"].Value;
- }
- else
- {
- Response.Redirect("logine.aspx");
- }
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- sql="SELECT * FROM userinfo inner join usergrade on usergrade.g_id=userinfo.u_grade WHERE u_User = '" +Request.QueryString["u_user"] + "'";
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"userinfo");
- Page.DataBind();
- //以下为搜索用户最近发表的5篇文章
- DataSet ds = new DataSet();
- OleDbDataAdapter cmd1 = new OleDbDataAdapter("select top 5 f3_id, f3_motif, f3_face, f3_sy, f3_name, f3_now from forum_3 where f3_name='"+Request.QueryString["u_user"]+"'order by f3_id desc",conn);
- OleDbCommand cmd2 = new OleDbCommand("select count(f3_id) from forum_3 where f3_name='"+Request.QueryString["u_user"]+"'",conn);
- conn.Open();
- showarticle=(int)cmd2.ExecuteScalar();
- //Create and fill the DataSet.
- cmd1.Fill(ds,"forum_3");
- //Create a second DataAdapter for the Titles table.
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- userarticle.DataSource = ds.Tables["forum_3"];
- Page.DataBind();
- //Close the connection.
- conn.Close();
- if (showarticle==0)
- {
- norecord="未搜索到任何记录";
- }
- //
- //以下为判断用户所任职务
- DataSet dspower = new DataSet();
- OleDbDataAdapter cmd3 = new OleDbDataAdapter("select * from user_f2 where um_name='"+Request.QueryString["u_user"]+"'order by um_id desc",conn);
- OleDbCommand cmd4 = new OleDbCommand("select count(um_id) from user_f2 where um_name='"+Request.QueryString["u_user"]+"'",conn);
- conn.Open();
- showpower=(int)cmd4.ExecuteScalar();
- //Create and fill the DataSet.
- cmd3.Fill(dspower,"user_f2");
- //Create a second DataAdapter for the Titles table.
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- userpower.DataSource = dspower.Tables["user_f2"];
- Page.DataBind();
- //Close the connection.
- conn.Close();
- if (showpower==0)
- {
- nopower="无职务";
- }
- //以下为定义用户帖子删除率
- if (Convert.ToInt32(dsPending.Tables[0].Rows[0]["u_postdel"])!=0)
- {
- upostdel=Convert.ToSingle((Convert.ToSingle(dsPending.Tables[0].Rows[0]["u_postdel"]))/(Convert.ToSingle(dsPending.Tables[0].Rows[0]["u_post"]))*100);
- }
- else
- {
- upostdel=0;
- }
- }
- #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
- }
- }