case ComboBox2.ItemIndex of
    0: sign:='=';
    1: sign:='>';
    2: sign:='<';
    3: sign:=' like ';
    4: sign:='<>';
  end;
  case ComboBox1.ItemIndex of
    0,4:fstr:='select * from Book_Info where(%s%s%s) order by %s';
    19: fstr:='select * from Book_Info where(%s%s#%s#) order by %s';
  else fstr:='select * from  Book_Info where(%s%s''%s'') order by %s';
  end;
  with ADOQuery1 do
  begin
    SQL.Clear;
    SQL.Add(Format(fstr,[ComboBox1.Text,sign,Edit1.Text,ComboBox1.Text]));
    Prepared;
    Open;
  end;
请问上段代码的意思!还有0,4和19分别是什么意思?三个WHERE后的又是什么意思?谢谢!

解决方案 »

  1.   

    0,4,19是combobox的选项编号
    where后面是打印用的格式化字符
      

  2.   

    当Combobox1.ItemIndex为0~4的时候..那么程序要做什么事..
    WHERE指的是查询语句的限定条件...
    就是这个样子..
    看些基础的书.都有说的..
      

  3.   

    0,4,19是combobox的項目编号。
    where后面是查詢語句用的格式化字符串。()
      

  4.   

    Format(Str+'%s'+'%s'...,[Str1,str2...])是給字符串中的變量賦值,%s 相當于一個變量.
    fstr:='select * from Book_Info where(%s%s%s) order by %s';
    Format(fstr,[ComboBox1.Text,sign,Edit1.Text,ComboBox1.Text])
    如果ComboBox2.ItemIndex =0 
    運行后Fstr:='select * from Book_Info where combobox1.Items[combobox1.ItemIndex]=Edit1.Text order by combobox1.Items[combobox1.ItemIndex]'