当前位置: 代码迷 >> ASP.NET >> 小弟我碰到一个很菜的有关问题,但是就是看不出那里错了
  详细解决方案

小弟我碰到一个很菜的有关问题,但是就是看不出那里错了

热度:2583   发布时间:2013-02-25 00:00:00.0
我碰到一个很菜的问题,但是就是看不出那里错了
//主程序开始/////////////////////////////////////////////////
i=0;
str_sbody= " ";
//初始化结束
                ds=obj.oleds( "select   *   from   class   order   by   id   desc ",0,0, "class ");
for(i=0;i <=ds.Tables[ "class "].Rows.Count-1;i+=1)
{
str_sbody=str_sbody+ " <table   cellpadding=6   cellspacing=0   width=100%   align=center     bordercolor=#0099cc   border=1> ";
str_sbody=str_sbody+ " <TR> <TD   bgColor=#e8f4ff   colSpan=6> <font   color=#000000> <B> "+ds.Tables[ "class "].Rows[i][ "class "].ToString()+ " </B> </font> </TD> </TR> ";

//版面信息
mycommand=new   OleDbCommand( "select   *   from   board   where   class= "+ds.Tables[ "class "].Rows[i][ "id "].ToString()+ " ",obj.link);
rs=mycommand.ExecuteReader();
while(rs.Read())
{
str_sbody=str_sbody+ " <TR> <TD   vAlign=top   width=*   bgColor=#f2f8ff> <font   color=#000000> ";
if(rs[ "icon "].ToString()!= " "&&rs[ "icon "].ToString()!=null)
{ str_sbody=str_sbody+ " <img   src=icon/ "+rs[ "icon "].ToString()+ ".gif   board=0> ";
}
str_sbody=str_sbody+ " <a   href=list.aspx?boardid= "+rs[ "boardid "].ToString()+ "> <font   color=#000066> "+rs[ "boardtype "]+ " </font> </a> <div   align=right   valign=top> <a   href=announce.aspx?boardid= "+rs[ "boardid "].ToString()+ "   title=快速发表主题> <img   src=images/fpost2.gif   border=0> </a> </div> ";
switch(rs[ "boardskin "].ToString())
{
case   "2 ": str_sbody=str_sbody+ " <font   color=gray> 精华论坛(普通用户不能发帖) </font> ";
break;
case   "3 ":
str_sbody=str_sbody+ " <font   color=gray> 正规论坛(只准会员进入) </font> ";
break;
case   "4 ":
str_sbody=str_sbody+ " <font   color=gray> 认证论坛(必须经过认证) </font> ";
break;
}
str_sbody=str_sbody+ " <br> "+Server.HtmlEncode(rs[ "readme "].ToString())+ " </font> </TD> ";
str_sbody=str_sbody+ " <TD   vAlign=center   align=middle   bgColor=#e8f4ff   width=80> ";
str_sbody=str_sbody+ " <img   src= "+rs[ "indexIMG "].ToString()+ "   board=0> <br> "+master(rs[ "BoardMaster "].ToString());
str_sbody=str_sbody+ " </TD> <TD   vAlign=center   noWrap   align=middle   width=25   bgColor=#e8f4ff> <font   color=#000000> "+rs[ "lasttopicnum "].ToString()+ "/ "+rs[ "todaynum "].ToString()+ " </font> </TD> ";
str_sbody=str_sbody+ " <TD   noWrap   width=250   bgColor=#e8f4ff> <font   color=#000000> 主题: ";

//列出最后的五编文章
OleDbCommand   cmd2=new   OleDbCommand( "select   *   from   bbs1   where   boardid= "+rs[ "boardid "].ToString()+ " ",obj.link);
rs2=cmd2.ExecuteReader();       *****到了这里就提示datareader已经打开,必须关闭
while(rs2.Read())
  相关解决方案