namespace baoge
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Configuration;
	using System.Collections;
	using System.ComponentModel;
	using System.Web.SessionState;
	using System.Web.UI;
	using System.Data.OleDb;

	/// <summary>
	///		FriendLink 的摘要说明。
	/// </summary>
	public class FriendLink : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.DataList DataList1;
		protected System.Web.UI.WebControls.HyperLink HyperLink1;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{

				string dbPath=System.Configuration.ConfigurationSettings.AppSettings["dbPath"];
				//定义连接字符串
				string ConnStr="Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath(dbPath);
				//创建数据库对像
				OleDbConnection connection=new OleDbConnection(ConnStr);
				
			
				String mysql="SELECT top 16 * FROM link order by linkid desc";
			
				OleDbDataAdapter da=new OleDbDataAdapter(mysql,connection);
				DataSet ds=new DataSet();
				da.Fill(ds,"link");
				this.DataList1.DataSource = ds.Tables["link"];
				this.DataList1.DataBind();
			}
		}

		#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
	}
}
