Var OrderStr:String;Begin OrderStr:=''; if CHECKBOX1.CHECKED then OrderStr := OrderStr+',field1'; if CHECKBOX2.CHECKED then OrderStr := OrderStr+',field2'; system.Delete(OrderStr,1,1); if OrderStr<>'' then OrderStr:=' Order BY '+OrderStr; ..... .....end;End;
比如有2个boolean.same, out : boolean;if (same = true) and (out=false) then select * from table order by same elseif (same = true) and (out=true) then select * from table order by same,outelseif (same = false) and (out=true) then select * from table order by out能不能把这些判断和语句写到一句话中. 因为九个条件,这样一个个的写就不大现实了!