• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

清宇诺诺

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

dataset 和DataTable的用法

以下包含了这两种不同属性的用法:

foreach (DataRow dr in dataset.Tables[0].Rows)
            {

                if (i != 0 && lujing!="")
                {
                    DataTable dt = new DataTable();
                    dt = new BLL.production().GetList_pro(" production_id=" + dr["Column1"]).Tables[0];
                    int n = int.Parse(dt.Rows.Count.ToString());
                    if (n == 0)
                    {
                        model.channel_id = 20;
                        model.category_id = 83;
                        model.production_id = int.Parse(dr["Column1"].ToString());
                        model.pmzc = dr["Column2"].ToString();
                        model.title1 = dr["Column3"].ToString();
                        model.author = dr["Column4"].ToString();
                        model.img_url1 = lujing + dr["Column5"].ToString();
                        model.size = dr["Column6"].ToString();
                        model.creation_year = dr["Column7"].ToString();
                        model.judge = dr["Column8"].ToString();
                        if (!string.IsNullOrEmpty(dr["Column10"].ToString()))
                        {
                            model.explain_1 = dr["Column10"].ToString();
                        }
                        model.explain_2 = dr["Column11"].ToString();
                        model.sort_id = 99;
                        if (bll.Add(model) < 1)
                        {

                        }
                    }
                    else {
                        foreach (DataRow item in dt.Rows)
                        {

                            Model.production model_1 = bll.GetModel(int.Parse(item["id"].ToString()));
                            model_1.price_1 = dr["Column9"].ToString();
                            if (bll.Update(model_1))
                            {

                            }
                        }
                       
                       
                    }
                   
                }
                i++;
            }

posted on 2014-12-03 15:03  清宇诺诺  阅读(208)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3