if edit1.text<>'' then
begin
》》》if Query1.FindField[combobox2.Text].DataType=ftInteger then
query1.SQL.Add(' where '+''''+QuotedStr(combobox2.Text)+' '+''''+QuotedStr(combobox3.Text)+''''+' '+edit1.Text);
》》》if Query1.Findfield[combobox2.Text].DataType=ftstring then
query1.SQL.Add(' where '+''''+QuotedStr(combobox2.Text)+' '+''''+QuotedStr(combobox3.Text)+''''+' '+''''+edit1.Text+'''');
end;
if edit2.text<>'' then
begin
》》》if Query1.Fields[combobox2.text].datatype=ftInteger then
query1.SQL.Add(' '+'''' +combobox1.Text+' '+''''+combobox5.Text+' '+''''+combobox11.text+''''+' '+edit2.Text);
》》》if Query1.Fields[combobox2.text].datatype=ftstring then
query1.SQL.Add(' '+'''' +combobox1.Text+' '+''''+combobox5.Text+' '+''''+combobox11.text+''''+' '+''''+edit2.Text+'''');
end;
》》》报错,
[Error] Unit15.pas(96): Not enough actual parameters
[Error] Unit15.pas(96): 'THEN' expected but identifier 'DataType' found
[Error] Unit15.pas(98): Not enough actual parameters
[Error] Unit15.pas(98): 'THEN' expected but identifier 'DataType' found
[Error] Unit15.pas(103): Incompatible types: 'Integer' and 'TCaption'
[Error] Unit15.pas(105): Incompatible types: 'Integer' and 'TCaption'

解决方案 »

  1.   

    FindField[combobox2.Text]
    改为FindField[combobox2.Text]query1.SQL.Add(' where '+''''+QuotedStr(combobox2.Text)+' '+''''+QuotedStr(combobox3.Text)+''''+' '+edit1.Text);
    里面的SQL语句拼写不对.后面的错误也是这种情况快点给我加分,我要长到两个三角了.
      

  2.   

    findfield[combobox.text]处和fieldbyname[combobox.text]处都报错,
    在》》》处,sql没错,在别的窗口不报错。(quotedstr用上更好);