同意 esu(ESU), fengjn(小枫) 棏 str:='select * from table where 1>0 ';if edit1.text<>'' then str:= str+' and name='+quotedstr(edit1.text); if edit2.text<>'' then str:= str+' and sex='+quotedstr(edit2.text);......
楼上的各位高手,按照这种方法,会有多少种情况,很多吗,21种?请指教,谢谢。------------------------------- 同意 esu(ESU), fengjn(小枫) 棏 str:='select * from table where 1>0 ';if edit1.text<>'' then str:= str+' and name='+quotedstr(edit1.text); if edit2.text<>'' then str:= str+' and sex='+quotedstr(edit2.text);
写一个永远为真的条件,再加 and 条件
同意楼上 s = "......where 1 = 1 "; while() { s = s + "and " + ....; }
str:='select * from table where 1>0 ';if edit1.text<>'' then
str:= str+' and name='+quotedstr(edit1.text);
if edit2.text<>'' then
str:= str+' and sex='+quotedstr(edit2.text);......
同意 esu(ESU), fengjn(小枫) 棏
str:='select * from table where 1>0 ';if edit1.text<>'' then
str:= str+' and name='+quotedstr(edit1.text);
if edit2.text<>'' then
str:= str+' and sex='+quotedstr(edit2.text);
s = "......where 1 = 1 ";
while()
{
s = s + "and " + ....;
}
这页分有点少,在下边的帖子补上http://expert.csdn.net/Expert/topic/2059/2059330.xml?temp=.8275415up有分;