码迷,mamicode.com
首页 > Windows程序 > 详细

C#多条件查出来的多个DataSet,然后循环将数据整合

时间:2019-04-24 09:28:53      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:多条件   tables   ==   list   copy   wro   text   nbsp   vat   

               

        private List<string> barList;
        public List<string> BarList
        {
            get { return barList; }
            set { barList = value; }
        }

   DataSet dt = new DataSet();
      DataSet dt2 = null;
                foreach (string data  in  help.BarList )
                {
                    dt = DbOperatorStd.GetDataSet("select  xxx from xxx where xxx=‘" + data + "‘");
                    if (dt2 == null)
                    {
                        dt2 = dt.Copy();
                    }
                    else
                    {
                        foreach (DataRow dtRow in dt.Tables[0].Rows)
                        {
                            DataRow m_nRow = null;
                            m_nRow = dt2.Tables[0].NewRow();
                            foreach (DataColumn dcCol in dt2.Tables[0].Columns)
                            {
                                m_nRow[dcCol.ColumnName] = dtRow[dcCol.ColumnName];
                            }
                            dt2.Tables[0].Rows.Add(m_nRow);
                        }
                    }
                }

C#多条件查出来的多个DataSet,然后循环将数据整合

标签:多条件   tables   ==   list   copy   wro   text   nbsp   vat   

原文地址:https://www.cnblogs.com/jcsmzxs/p/10760425.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!