/// <summary> /// ��ʾ���� /// </summary> private void PopulateData() { #region ��ʼ������ DataTable dataTable_catalog = new DataTable(); DataTable dataTable_board = new DataTable(); DataTable dataTable_boardmaster = new DataTable(); DataSet ds = new DataSet(); SqlDataReader dr_catalog = null; SqlDataReader dr_board = null; SqlDataReader dr_boardmaster = null; BBSClass bbsclass = new BBSClass(); BBSCatalog catalog = new BBSCatalog();//���� BBSBoard board = new BBSBoard();//��� BBSForumItem item = new BBSForumItem();//���ӵ���Ϣ BBSBoardmaster master = new BBSBoardmaster();//������Ϣ BBSReplay replay = new BBSReplay();//�ظ���Ϣ #endregion try { //try //�ж�Ȩ�� Admin = bbsclass.AdminBBS(Username, Int32.Parse(classid)); ViewState["Admin"] = Admin; Bulletin = bbsclass.AdminSysBulletin(Username, Int32.Parse(classid)); ViewState["Bulletin"] = Bulletin; A1.Visible = Admin; //�õ������Ϣ dr_catalog = bbsclass.GetBBSCatalog(); if (Admin) { HttpCookie cookie = new HttpCookie("UDSBBSAdmin", "1"); Response.Cookies.Add(cookie); } else { HttpCookie cookie = new HttpCookie("UDSBBSAdmin", "0"); Response.Cookies.Add(cookie); } if (Bulletin) { HttpCookie cookie1 = new HttpCookie("UDSBBSBulletinAdmin", "1"); Response.Cookies.Add(cookie1); } else { HttpCookie cookie1 = new HttpCookie("UDSBBSBulletinAdmin", "0"); Response.Cookies.Add(cookie1); } dataTable_catalog = Tools.ConvertDataReaderToDataTable(dr_catalog); dataTable_catalog.TableName = "catalogTable"; ds.Tables.Add(dataTable_catalog); //�õ������Ϣ if (Admin) dr_board = bbsclass.GetAllBBSBoard(); else dr_board = bbsclass.GetBBSBoard((string)Username); dataTable_board = Tools.ConvertDataReaderToDataTable(dr_board); dataTable_board.TableName = "boardTable"; ds.Tables.Add(dataTable_board); //�õ�������Ϣ dr_boardmaster = bbsclass.GetBoardMaster(); dataTable_boardmaster = Tools.ConvertDataReaderToDataTable(dr_boardmaster); dataTable_boardmaster.TableName = "boardmasterTable"; ds.Tables.Add(dataTable_boardmaster); //���ӱ�������ݰ� ds.Relations.Add("catolog_board", ds.Tables["catalogTable"].Columns["catalog_id"], ds.Tables["boardTable"].Columns["catalog_id"], false); ds.Relations.Add("board_boardmaster", ds.Tables["boardTable"].Columns["board_id"], ds.Tables["boardmasterTable"].Columns["board_id"], false); rpt_catalog.DataSource = ds.Tables["catalogTable"].DefaultView; Page.DataBind(); } finally { dr_board.Close(); dr_boardmaster.Close(); dr_catalog.Close(); } }