双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

asp.net 执行这样的代码会效率么,求大神解答,谢了

兵哥495 兵哥495 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
protected void bindggd()
{
using (SqlConnection conn = new SqlConnection(Conn.CONN_STRING))
{
if (Cache["xiaochi"] == null)
{
StringBuilder sb = new StringBuilder("select top 5 KeyId,CategoryId,Title from XF_News where CategoryId=18 and ShenHe=1 order by TuiJian desc,Orders desc,KeyId desc;");

sb.Append("select PicPathS,Title,TitleLinkUrl from XF_News where CategoryId=19 and ShenHe=1 order by TuiJian desc,Orders desc,KeyId desc;");

sb.Append("select * from win_sdtime;");
DataSet ds = SqlHelper.ExecuteDataset(conn, CommandType.Text, sb.ToString());
Cache.Insert("xiaochi", ds, null, DateTime.Now.AddMinutes(10), TimeSpan.Zero);

rptitemgg.DataSource = ds.Tables[0];
rptitemgg.DataBind();

rprBanner.DataSource = ds.Tables[1];
rprBanner.DataBind();

dqtime.InnerText =ds.Tables[2].Rows[0]["stimeOne"].ToString();
dqtimem.InnerText =ds.Tables[2].Rows[0["stimeTwo"].ToString();
hdtime.InnerText =ds.Tables[2].Rows[0["stimeThree"].ToString();
hdtimem.InnerText=ds.Tables[2].Rows[0]["stimeFour"].ToString();

}
else
{
DataSet ds = (DataSet)Cache["xiaochi"];

rptitemgg.DataSource = ds.Tables[0];
rptitemgg.DataBind();

rprBanner.DataSource = ds.Tables[1];
rprBanner.DataBind();

dqtime.InnerText = ds.Tables[2].Rows[0]["stimeOne"].ToString();
dqtimem.InnerText = ds.Tables[2].Rows[0]["stimeTwo"].ToString();
hdtime.InnerText = ds.Tables[2].Rows[0]["stimeThree"].ToString();
hdtimem.InnerText = ds.Tables[2].Rows[0]["stimeFour"].ToString();
}
}
}
...全文

相关推荐

评论 13
收藏 已收藏
分享
返回顶部
兵哥495
.NET社区 62,274 成员 668,968 内容