解决方案 »
- 关于cs架构的问题,请高手指点。
- 未将对象引用设置到对象实例
- ext Ext.Panel,怎么检测已经存在?
- C#大家都使用哪种UML配套建模工具?
- 请问如何加DataGrid 的背景图片,怎么重写BackGroundImage属性,希望给点完整代码谢谢!
- 关于MDI背景色及menustrip隐藏的问题
- 已经将数据写入dataTable,怎样将DataTable里的数据写如数据库?
- C# 使用UDP多端口异步监听,请教高手,急用!~
- 我在数据库里读出的数据,有可能是001也有可能是010或者是100。我要去年前面的0怎么做。
- 在DataView里,怎么样得到当前行的DataRowView?
- 关于使用Aspose.Words.dll操作word的问题
- 这三个字节是怎么来的???
//将数据项目加入缓存
protected void btnAddCache_Click(object sender, EventArgs e)
{
//利用Cache.Add()方法将数据加入缓存
Cache.Add("Name", txtUserName.Text, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
Cache.Add("Photo", txtTel.Text, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
Cache.Add("Position", txtJob.Text, null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
txtMsg.Text = "缓存加入成功!";
}
//显示缓存数据CodeGo.net/
protected void btnDisplayCache_Click(object sender, EventArgs e)
{
IDictionaryEnumerator CacheIDE = Cache.GetEnumerator();//显示缓存数据
int i = 0;
string info = null;
info += "缓存项目数据(Key / Value):" + "<br>";
while (CacheIDE.MoveNext())//循环输出缓存项目
{
info += i.ToString() + ". ";
info += CacheIDE.Key.ToString() + " : ";
info += CacheIDE.Value.ToString() + "<br>";
i++;
}
if (Cache["Name"] == null)//判断缓存是否有数据项目
{
txtMsg.Text = "缓存内容为Null值!";
}
else
{
txtMsg.Text = info;
}
}