].value = n_topic.content ;
try
{
myconn.open() ;
mycommand.executenonquery() ;
//清场
myconn.close() ;
}
catch(exception e)
{
throw(new exception("取贴子失败:" + e.tostring())) ;
}
return true;
}
/// <summary>
/// 取的贴子列表
/// </summary>
/// <remarks>
/// 返回一个topic数组
/// </remarks>
public arraylist gettopiclist()
{
//定义一个forum数组做为返回值
arraylist arrforumlist =new arraylist() ;
//从数据库中读取留言列表
myconn myconn = new myconn();
sqlcommand mycommand = new sqlcommand() ;
mycommand.activeconnection = myconn ;
mycommand.commandtext = "n_gettopiclist" ; //调用存储过程
mycommand.commandtype = commandtype.storedprocedure ;
try
{
myconn.open() ;
sqldatareader myreader ;
mycommand.execute(out myreader) ;
for (int i = 0 ; myreader.read() ; i++)
{
notepage objitem = new notepage() ;
objitem.id = myreader["id"].tostring().toint32() ;
objitem.title = myreader["title"].tostring() ;
objitem.author = myreader["author"].tostring() ;
objitem.adddate = myreader["adddate"].tostring().todatetime();
objitem.content = myreader["content"].tostring();
arrforumlist.add(objitem) ;
}
//清场
myreader.close();
myconn.close() ;
}
catch(sqlexception e)
{
throw(new exception("数据库出错:" + e.tostring())) ;
//return null ;
}
return arrforumlist ;
}
}
}