你的问题和你的说明是矛盾的呀,说清楚一点行不行?

解决方案 »

  1.   

    四个TEDit
    品名 edtPm
    编号edtBh
    单位edtDw
    时间edtRq
    sparam:array[0..3] of string;
    for i:= 0 to 3 do
      sparam[i]:='';
    sql :=' select * from  table1 where 1=1 ';
    if edtPm.text<>'' then
      sparam[0]:=' and 品名='''+ edtPm.text+'''';
    if edtBh.text<>'' then
      sparam[1]:=' and 编号='''+ edtBh.text+'''';
    if edtDw.text<>'' then
      sparam[0]:=' and 单位='''+ edtDw.text+'''';
    if edtRq.text<>'' then
      sparam[0]:=' and 时间='''+ edtRq.text+'''';
    for i:=0 to 3 do
     sql := sql + sparam[i];
    query1.close;
    query1.sql.clear;
    qurey1.sql.add(sql);
    qyery1.open