问题描述
publicpartialclassforumlist:FunctionBase{protectedvoidPage_Load(objectsender,EventArgse){if(Request["type"]==null){Response.Redirect("/code/forumindex.aspx");return;}newscontent.InnerHtml=ShowTopNews();stringtype_sql="select*fromforumtypewhereid="+Request["type"];SqlDataReadertype_sr=SQLBASE.ExecuteReader(type_sql);if(type_sr.Read()){typetext.InnerHtml=type_sr["title"].ToString();Page.Title=type_sr["title"].ToString();}if(Session["username"]!=null){showimg.InnerHtml+="<ahref='/code/forumreply.aspx?action=newforum&type="+Request["type"]+"'target='_self'><imgalt='发新话题'border='0'src='/code/images/newtopic.gif'/></a>";}stringlist_sql="selectforum.*,reg1.usernamefromforum"+"leftjoinreguserasreg1onreg1.rid=forum.initiator"+"wheretype='"+Request["type"]+"'";DataSetds=SQLBASE.FillDataSet(list_sql);for(inti=0;i<ds.Tables[0].Rows.Count;i++){DataRowrow=ds.Tables[0].Rows[i];/*******************总回复人数********************************/stringrevert_sql="selectcount(id)astotalfromenlistforumwhereforumid="+row["forumid"];SqlDataReadersr=SQLBASE.ExecuteReader(revert_sql);inttotal=0;if(sr.Read()==true){total=(int)sr[0];}/******************最后回贴人*********************************/stringlastrevert_sql="selecttop1enlistforum.*,reguser.usernamefromenlistforumleftjoinreguseronenlistforum.pid=reguser.ridwhereforumid="+row["forumid"]+"orderbyenlistdatedesc";SqlDataReaderlast_sr=SQLBASE.ExecuteReader(lastrevert_sql);stringlastText="无回复";if(last_sr.Read()==true){lastText=last_sr["enlistdate"].ToString()+"by"+last_sr["username"].ToString();}stringimgurl="";if((int)row["isclose"]!=1){if(total>10){imgurl="<imgsrc='/code/images/red_folder.gif'border='0'alt='热点帖子'/>";}elseimgurl="<imgsrc='/code/images/folder.gif'border='0'alt='普通帖子'/>";}else{imgurl="<imgsrc='/code/images/lock_folder.gif'border='0'alt='该主题帖子已经关闭'/>";}smallforumlist.InnerHtml+="<tr>"+"<tdstyle='width:5%;height:30px;background-color:#FFFfFF'align='center'valign='middle'>"+imgurl+"</td>"+"<tdstyle='width:5%;height:30px;background-color:#F8F8F8'align='center'valign='middle'>"+"</td>"+"<tdstyle='width:50%;height:30px;background-color:#FFFfFF'align='left'valign='middle'><ahref='/code/forumdisplay.aspx?forumid="+row["forumid"]+"'target='_blank'title='点击查看详细内容'>"+row["title"]+"</a>"+"</td>"+"<tdstyle='width:20%;height:30px;background-color:#F8F8F8'align='center'valign='middle'>"+row["createdate"]+"by"+row["username"]+"</td>"+"<tdstyle='width:5%;height:30px;background-color:#FFFfFF'align='center'valign='middle'>"+total+"</td>"+"<tdstyle='width:15%;height:30px;background-color:#F8F8F8'align='center'valign='middle'>"+lastText+"</td>"+"</tr>";}//smallforumlist.InnerHtml="";}
解决方案
解决方案二:
很多分啊
解决方案三:
帮顶
解决方案四:
看大概文件是回复帖子的语句~page_load里是判断request请求和session里是否为空,为空则不能回复!不为空就跳转到'/code/forumreply.aspx?action页面,当然这个页面是带参数的:newforum&type="+Request["type"]+"'target='_self'!最后回帖人里的语句是判断分页的和查看的!另:SqlDataReader这个是绑定控件语句,就是将从数据库中的查出的内容转换到sr字符集里!而DataRowrow语句是控件里的行数!至于SQL语句我就不用解释了吧?我的联系方式是MSN:lindblum_88@hotmail.com,要是还有不清楚的地方联系我!