}
}
public int TopicCount
{
get
{
return m_intTopicCount ;
}
}
public int UserCount
{
get
{
return m_intUserCount ;
}
}
//构造函数
public BBS(string a_strTitle)
{
//
// TODO: Add Constructor Logic here
//
m_strTitle = a_strTitle ;
//读取数据库
MyConnection myConn = new MyConnection() ;
SQLCommand myCommand = new SQLCommand() ;
myCommand.ActiveConnection = myConn ;
myCommand.CommandText = "up_GetBBSInfo" ; //调用存储过程
myCommand.CommandType = CommandType.StoredProcedure ;
try
{
myConn.Open() ;
SQLDataReader myReader ;
myCommand.Execute(out myReader) ;
if (myReader.Read())
{
m_intForumCount = (int)myReader["ForumCount"] ;
m_intTopicCount = (int)myReader["TopicCount"] ;
m_intUserCount = (int)myReader["UserCount"] ;
}
else
{
throw(new Exception("表或存储过程不存在")) ;
}
//清场
myReader.Close();
myConn.Close() ;
}
catch(SQLException e)
{
throw(new Exception("数据库出错:" e.Message)) ;
}
}
}
}
和刚才我们讲的稍有不同,首先看第一行namespace MyOwnClass , 声明目前这个类的名字空间是MyOwnClass,名字空间就像一个包,其中可以包含很多类。再看这行: using System; 这个告诉编译器,我要引用System名字空间里的对象。然后其他的就好理解了吧?
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




