jianinclude2.ascx.cs
资源名称:论坛源码.rar [点击查看]
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:2k
源码类别:
.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>
- /// jianinclude2 的摘要说明。
- /// </summary>
- public class jianinclude2 : System.Web.UI.UserControl
- {
- protected System.Web.UI.WebControls.Repeater parent;
- private void Page_Load(object sender, System.EventArgs e)
- {
- DataSet ds = new DataSet();
- OleDbConnection cnn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);
- OleDbDataAdapter cmd1 = new OleDbDataAdapter("select f1_id,f1_caption from forum_1 order by f1_order",cnn);
- //Create and fill the DataSet.
- cmd1.Fill(ds,"forum_1");
- //Create a second DataAdapter for the Titles table.
- OleDbDataAdapter cmd2 = new OleDbDataAdapter("select f2_id,f2_caption,f2_sy from forum_2 order by f2_by",cnn);
- cmd2.Fill(ds,"forum_2");
- //Create the relation bewtween the Authors and Titles tables.
- ds.Relations.Add("myrelation",
- ds.Tables["forum_1"].Columns["f1_id"],
- ds.Tables["forum_2"].Columns["f2_sy"]);
- //Bind the Authors table to the parent Repeater control, and call DataBind.
- parent.DataSource = ds.Tables["forum_1"];
- Page.DataBind();
- //Close the connection.
- cnn.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
- private void grdPending_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- }
- }
- }