强类型数据集如何实现缓存?

qingchunjingwu 2004-10-25 12:10:44
private void BindISPGrid()
{
//返回数据集的方法类
ProvideData pdse = new ProvideData();
try
{
//这里实例了一个强类型数据集
DataSetCharge dsc = new DataSetCharge();
if((DataSetCharge)Cache["ISP"]== null)
{
//GetAllISP方法返回一个有数据的强类型数据庥
dsc.Merge(pdse.GetAllISP());
//给缓存
Cache["ISP"]== dsc;

this.lblErrMsg.Visible = true;
this.lblErrMsg.Text = "已将数据集放入到缓存中";
}
else
{
this.lblErrMsg.Visible = true;
this.lblErrMsg.Text = "从缓存中检索到的数据集";
}
//转换出来绑定
this.dgridISP.DataSource = (DataSetCharge)Cache["ISP"];
this.dgridISP.DataBind();
}
catch(System.Exception ex)
{
this.lblErrMsg.Visible = true;
this.lblErrMsg.Text = ex.Message;
}

结果没数据。
...全文
131 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shuker 2004-10-25
  • 打赏
  • 举报
回复
DataSetCharge支持序列化吗?
如果支持,我觉得这段代码应该可以的
否则的话那肯定会有运行异常的
qingchunjingwu 2004-10-25
  • 打赏
  • 举报
回复
问了二天,看来真是没人会啊
zwp315 2004-10-25
  • 打赏
  • 举报
回复
什么是强类型数据?难道还有弱类型数据吗?盼楼下的提示:
qingchunjingwu 2004-10-25
  • 打赏
  • 举报
回复
.............
happyjun2000 2004-10-25
  • 打赏
  • 举报
回复
dataset不也是强类型,也可以缓存的呀

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧