我有一个带checkbox的treevie控件,作为sql语句的查询条件,当treeview的checkbox选中的时候就要查询选中的那个checkbox表示的值,但是treeview的子节点很多,这个要怎么拼接才能够简单点啊?
select AreaName,foodClass,foodName,inputdate,producedata,validperiod,
SUM(foodamount) as 库存,foodunit ,Unitprice,(SUM(foodamount)*Unitprice) as newtotalprice
from FoodRepertory_T
where inputdate between '2014-01-01 0:00:00' and '2016-5-3'
and outdate between '2014-01-01 0:00:00' and '2016-5-3'
and and foodClass = '肉禽1'
or inputdate between '2014-01-01 0:00:00' and '2016-5-3'
and and foodClass = '肉禽2'
and outdate is null
group by AreaName,foodClass,foodName,producedata,validperiod,inputdate,foodunit ,Unitprice
foodClass就是treeview的可选值,我现在的思路是foreach treeview的所有节点,当选中的时候 把选中的
inputdate between '2014-01-01 0:00:00' and '2016-5-3'
and outdate between '2014-01-01 0:00:00' and '2016-5-3'
and and foodClass = '肉禽1'
or inputdate between '2014-01-01 0:00:00' and '2016-5-3'
and and foodClass = '肉禽2'
and outdate is null
group by AreaName,
重写一次,并拼接到sql语句中,这样感觉好麻烦啊!
------解决思路----------------------
原来你是在考验我去.一会儿你把我给整晕了