剑胆琴心-.Net 学习笔记

天下大事,必作于细;天下难事,必成于易...

修改DataTable

string key = "k_xxx";
string sql = "select * from xxx where xxx";
           
DataTable dt = HttpContext.Current.Cache[key] as DataTable;
if (dt == null)
{
                dt = Dbl.CreateSqlDataTable(sql); 
                int iCount = dt.Rows.Count;
               
                //批量修改字段
                for (int i=0; i<iCount; i++)
                {
                    dr.BeginEdit();
                    dr["nickName"] = "XXX";
                    dr.EndEdit();                   
                }
                 

                dt.AcceptChanges();     
               
                HttpContext.Current.Cache.Insert(key, dt, null, DateTime.Now.AddSeconds(3600),  System.Web.Caching.Cache.NoSlidingExpiration);
}

阅读更多
文章标签: string null sql 360
个人分类: C# / ASP.Net
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

修改DataTable

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭