欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

list.aspx.cs

一个比较不错的专门为技术型站点订制的专业论坛源码
CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace bbs
{
	/// <summary>
	/// Summary description for list.
	/// </summary>
	public class list : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
		protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		protected System.Data.SqlClient.SqlConnection sqlConnection1;
		protected bbs.BBSDataSet bbsDataSet1;
		protected System.Web.UI.HtmlControls.HtmlForm Form1;
		protected System.Data.DataView dataView1;


		private void Page_Load(object sender, System.EventArgs e)
		{
			string board;
			if(Request["board"] == null)
				board = "5";
			else
				board = Request["board"];		
			this.sqlSelectCommand1.CommandText = "SELECT Title, FileName, PostTime, Status, Click, Reply, LastReply, ID FROM BBS WHERE Board = " + board + " order by LastReply desc";
			this.sqlDataAdapter1.Fill(this.bbsDataSet1,"BBS");
			this.DataGrid1.CurrentPageIndex = 0;
			this.DataGrid1.DataBind();
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			this.sqlConnection1.ConnectionString = (string)Application["ConnectionString"];
			this.sqlSelectCommand1.CommandText = "SELECT Title, FileName, PostTime, Status, Click, Reply, LastReply, Score, ID FROM BBS WHERE (Board = '" + Request["board"] + "')";
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
			this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
			this.bbsDataSet1 = new bbs.BBSDataSet();
			this.dataView1 = new System.Data.DataView();
			((System.ComponentModel.ISupportInitialize)(this.bbsDataSet1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
			this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged);
			// 
			// sqlDataAdapter1
			// 
			this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "BBS", new System.Data.Common.DataColumnMapping[] {
																																																			 new System.Data.Common.DataColumnMapping("Title", "Title"),
																																																			 new System.Data.Common.DataColumnMapping("FileName", "FileName"),
																																																			 new System.Data.Common.DataColumnMapping("PostTime", "PostTime"),
																																																			 new System.Data.Common.DataColumnMapping("Status", "Status"),
																																																			 new System.Data.Common.DataColumnMapping("Click", "Click"),
																																																			 new System.Data.Common.DataColumnMapping("Reply", "Reply"),
																																																			 new System.Data.Common.DataColumnMapping("LastReply", "LastReply"),
																																																			 new System.Data.Common.DataColumnMapping("Score", "Score")})});
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT Title, FileName, PostTime, Status, Click, Reply, LastReply, Score, ID FROM" +
				" BBS WHERE (Board = N\'1\')";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "data source=LUYANSC;initial catalog=BBS;integrated security=SSPI;persist security" +
				" info=False;workstation id=LUYANSC;packet size=4096";
			// 
			// bbsDataSet1
			// 
			this.bbsDataSet1.DataSetName = "BBSDataSet";
			this.bbsDataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
			this.bbsDataSet1.Namespace = "http://www.tempuri.org/BBSDataSet.xsd";
			// 
			// dataView1
			// 
			this.dataView1.Table = this.bbsDataSet1.BBS;
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.bbsDataSet1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();

		}
		#endregion

		private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
		{
			this.DataGrid1.CurrentPageIndex = e.NewPageIndex;
			this.DataGrid1.DataBind();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -