日期:2014-05-17 浏览次数:20580 次
private int getAdsCount(int position) {
int count = 0;
if (Application["pos_" + position] == null) // 总是提示此行未将对象引用设置到对象。
{
SqlParameter[] param = {
new SqlParameter("@ChannelID",SqlDbType.Int,4),
new SqlParameter("@AreaID",SqlDbType.Int,8),
new SqlParameter("@CategoryID",SqlDbType.Int,8),
new SqlParameter("@CategoryB",SqlDbType.Int,8),
new SqlParameter("@PositionID",SqlDbType.BigInt,8)
};
param[0].Value = 4;
param[1].Value = AreaID;
param[2].Value = CategoryID;
param[3].Value = CategoryB;
param[4].Value = position;
DataSet ds = PubPage.Common.SqlHelper_V1.ExecuteDataset(conn, CommandType.StoredProcedure, "sp_GetAdList", param);
count = ds.Tables[0].Rows.Count;
Application.Lock();
Application["pos_" + position] = count;
Application.UnLock();
} else {
count = Convert.ToInt32(Application["pos_" + position].ToString());
}
return count;
}