jianinclude3.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;
- using System.Web.Security;
- using System.Security.Cryptography;
- /// <summary>
- /// jianinclude3 的摘要说明。
- /// </summary>
- public class jianinclude3 : System.Web.UI.UserControl
- {
- protected System.Data.OleDb.OleDbCommand cmd;
- protected System.Data.OleDb.OleDbConnection conn;
- public DataSet dsuser;
- protected System.Web.UI.WebControls.Repeater parent;
- public DataSet dsPending;
- public DataSet dsPending1;
- public string f2name;
- public int f2sy;
- public string f1name;
- public string sql;
- public string sql1;
- public string f2id;
- public int f2pass;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if (Request.QueryString["f2_id"]!=null)
- {
- f2id=Convert.ToString(Request.QueryString["f2_id"]);
- }
- else
- {
- if (Request.Form["f2_sy"]!=null)
- {f2id=Convert.ToString(Request.Form["f2_sy"]);}
- else
- {f2id=Convert.ToString(Request.Form["f3_sy"]);}
- }
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- //搜索论坛
- sql="select f2_id,f2_caption,f2_sy,f2_pass from forum_2 where f2_id="+f2id+"";
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"forum_2");
- Page.DataBind();
- f2name=Convert.ToString(dsPending.Tables[0].Rows[0]["f2_caption"]);
- f2sy=Convert.ToInt32(dsPending.Tables[0].Rows[0]["f2_sy"]);
- f2pass=Convert.ToInt32(dsPending.Tables[0].Rows[0]["f2_pass"]);
- //判断用户是否有权限浏览加密论坛及其文章
- if (f2pass==1)
- {
- if (Request.Cookies["jusername"]==null)
- {
- Response.Redirect("logine.aspx");
- }
- if (Convert.ToInt32(Request.Cookies["jpower"].Value)>2)
- {
- Response.Redirect("logine.aspx");
- }
- }
- //搜索论坛大类
- sql1="select f1_caption from forum_1 where f1_id="+f2sy+"";
- dsPending1=new DataSet();
- OleDbDataAdapter adWord1=new OleDbDataAdapter(sql1,conn);
- adWord1.Fill(dsPending1,"forum_1");
- Page.DataBind();
- f1name=Convert.ToString(dsPending1.Tables[0].Rows[0]["f1_caption"]);
- //搜索论坛子类
- DataSet ds = new DataSet();
- OleDbDataAdapter cmd1 = new OleDbDataAdapter("select f2_id,f2_caption,f2_sy from forum_2 where f2_sy="+f2sy+" order by f2_by asc ",conn);
- conn.Open();
- cmd1.Fill(ds,"forum_2");
- //Create a second DataAdapter for the Titles table.
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- parent.DataSource = ds.Tables["forum_2"];
- Page.DataBind();
- dsPending.Clear();
- dsPending1.Clear();
- 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
- }
- }