日期:2014-05-17  浏览次数:21096 次

请教list select 满足2个字段的值都要存在同一个表中
本帖最后由 oVivian1234567 于 2013-01-08 16:19:13 编辑
代码:
 foreach (EN_ec_city en in enlist)
                        {
                           // DataRow[] df = dtlogistice.Select(String.Format("startaddr='{0}' and endaddr='{1}'", en.city_name, en.city_name));
                            DataRow[] df = dtlogistice.Select(String.Format("startaddr='{0}'", en.city_name));
                           
                           // DataRow[] dd = dtlogistice.Select(String.Format("endaddr='{0}'", en.city_name));
                            foreach (DataRow row in df)
                            {
                                DataRow ro = newgvprice.NewRow();
                                foreach (DataColumn co in cols)
                                {
                                    ro[co.ColumnName] = row[co.ColumnName];
                                }
                                newgvprice.Rows.Add(ro);
                            }
                        }


DataRow[] dd = dtlogistice.Select(String.Format("endaddr='{0}'", en.city_name));endaddr也要满足存在en.city_name,请问这要怎么添加条件

------解决方案--------------------
用模糊查询
city _name Like '%startaddr%' and city _name Like '%endaddr%'
------解决方案--------------------