/// <summary>
/// 取的贴子列表
/// </summary>
/// <remarks>
/// 返回一个forum数组
/// </remarks>
public ArrayList GetForumList()
{
//定义一个forum数组做为返回值
ArrayList arrForumList =new ArrayList() ;
//从数据库中读取版面列表
MyClass.Util.MyConnection myConn = new MyClass.Util.MyConnection("bbs") ;
SQLCommand myCommand = new SQLCommand() ;
myCommand.ActiveConnection = myConn ;
myCommand.CommandText = "up_GetForumList" ; //调用存储过程
myCommand.CommandType = CommandType.StoredProcedure ;
try
{
myConn.Open() ;
SQLDataReader myReader ;
myCommand.Execute(out myReader) ;
for (int i = 0 ; myReader.Read() ; i++)
{
MyClass.BBS.Forum objItem = new MyClass.BBS.Forum() ;
objItem.ID = myReader["id"].ToString().ToInt32() ;
objItem.Name = myReader["title"].ToString() ;
objItem.Description = myReader["description"].ToString() ;
objItem.TopicCount = myReader["topiccount"].ToString().ToInt32() ;
objItem.Layer = myReader["layer"].ToString().ToInt32() ;
objItem.FatherID = myReader["fatherid"].ToString().ToInt32() ;
objItem.Master = new BBSUser(myReader["userid"].ToString().ToInt32() ,
myReader["username"].ToString() , myReader["email"].ToString() ,
myReader["homepage"].ToString() , myReader["signature"].ToString()) ;
arrForumList.Add(objItem) ;
}
//清场
myReader.Close();
myConn.Close() ;
}
catch(SQLException e)
{
throw(new Exception("数据库出错:" + e.ToString())) ;
//return null ;
}
return arrForumList ;
}