会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Konimeter
Konimeter的Blog主站
Email:
koni@21cn.com
Konimeter@Solartimes
QQ:
670955
Konimeter@ShangXun
MSN:
konimeter@hotmail.com
博客园
首页
新随笔
联系
订阅
管理
GetPostsByMonths
获取每个月的Post数量,一般用于首页的“列表”
@SectionID=BlogID=14,氯胺酮的Blog,
结果样式如下:
2005年10月(10)
2005年9月(2)
GetPostsBtMonth
public
override
ArrayList GetPostsByMonths(
int
BlogID)
{
using
( SqlConnection connection
=
GetSqlConnection() )
{
using
(SqlCommand command
=
new
SqlCommand(databaseOwner
+
"
.cs_weblog_PostsByMonthList
"
, connection))
{
command.CommandType
=
CommandType.StoredProcedure;
command.Parameters.Add(
"
@SectionID
"
, SqlDbType.Int,
4
).Value
=
BlogID;
//
14
//
@SectionID=BlogID=14,氯胺酮的Blog,
connection.Open();
using
(SqlDataReader reader
=
command.ExecuteReader(CommandBehavior.CloseConnection
|
CommandBehavior.SingleResult))
{
ArrayList items
=
new
ArrayList();
ArchiveDataItem ad
=
null
;
while
(reader.Read())
{
ad
=
new
ArchiveDataItem();
ad.Date
=
new
DateTime((
int
)reader[
"
Year
"
],(
int
)reader[
"
Month
"
],
1
);
ad.Count
=
(
int
)reader[
"
Count
"
];
items.Add(ad);
}
reader.Close();
connection.Close();
command.Dispose();
return
items;
}
}
}
}
posted on
2005-10-18 11:28
Konimeter
阅读(
230
) 评论(
0
)
收藏
举报
刷新页面
返回顶部