go.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>
- /// go 的摘要说明。
- /// </summary>
- public class go : System.Web.UI.Page
- {
- protected int intRunTime;
- protected DateTime dtStartTime = DateTime.Now;
- protected System.Data.OleDb.OleDbCommand cmd;
- protected System.Data.OleDb.OleDbCommand cmd2;
- protected System.Data.OleDb.OleDbConnection conn;
- public DataSet dsPending;
- public string sql;
- public int showarticle;
- public int f3_id;
- public string errormessage;
- private void Page_Load(object sender, System.EventArgs e)
- {
- conn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- if (Convert.ToString(Request.QueryString["type"])=="1")
- {
- sql="select f3_id from forum_3 where f3_sy="+Request.QueryString["f2_id"]+" and f3_id<"+Request.QueryString["f3_id"]+" order by f3_id desc";
- OleDbCommand cmd2 = new OleDbCommand("select count(f3_id) from forum_3 where f3_sy="+Request.QueryString["f2_id"]+" and f3_id<"+Request.QueryString["f3_id"]+"",conn);
- OleDbCommand cmd = new OleDbCommand(sql,conn);
- conn.Open();
- showarticle=(int)cmd2.ExecuteScalar();
- errormessage="没有找到上一个主题。";
- }
- if (Convert.ToString(Request.QueryString["type"])=="2")
- {
- sql="select f3_id from forum_3 where f3_sy="+Request.QueryString["f2_id"]+" and f3_id>"+Request.QueryString["f3_id"]+" order by f3_id asc";
- OleDbCommand cmd2 = new OleDbCommand("select count(f3_id) from forum_3 where f3_sy="+Request.QueryString["f2_id"]+" and f3_id>"+Request.QueryString["f3_id"]+"",conn);
- OleDbCommand cmd = new OleDbCommand(sql,conn);
- conn.Open();
- showarticle=(int)cmd2.ExecuteScalar();
- errormessage="没有找到下一个主题。";
- }
- dsPending=new DataSet();
- OleDbDataAdapter adWord=new OleDbDataAdapter(sql,conn);
- adWord.Fill(dsPending,"forum_3");
- Page.DataBind();
- if (showarticle!=0)
- {
- f3_id=Convert.ToInt32(dsPending.Tables[0].Rows[0]["f3_id"]);
- Response.Redirect("article_det.aspx?f2_id="+Request.QueryString["f2_id"]+"&f3_id="+f3_id+"&pageindex=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
- }
- }