这是一个查询的代码
ar
  where: Array[1..16] Of String;
  i: integer;
  money : string;
Begin
  If wDate.Text = '' Then
    where[1] := '([Date] like ''%'' or [Date] is null)'
  Else
    where[1] := '([Date] like ''%' + trim(wDate.Text) + '%'')';
  If wContractCode.Text = '' Then
    where[2] := '(ContractCode like ''%'' or ContractCode is null)'
  Else
    where[2] := '(ContractCode like ''%' + trim(wContractCode.Text) + '%'')';
  If wContent.Text = '' Then
    where[3] := '(Content like ''%'' or Content is null)'
  Else
    where[3] := '(Content like ''%' + trim(wContent.Text) + '%'')';
  If wCompanyName.Text = '' Then
    where[4] := '(CompanyName like ''%'' or CompanyName is null)'
  Else
    where[4] := '(CompanyName like ''%' + trim(wCompanyName.Text) + '%'')';
  If wKind.Text = '' Then
    where[5] := '(Kind like ''%'' or Kind is null)'
  Else
    where[5] := '(Kind like ''%' + trim(wKind.Text) + '%'')';
  If wPersonCode.Text = '' Then
    where[6] := '(PersonCode like ''%'' or PersonCode is null)'
  Else
    where[6] := '(PersonCode = ''' + (wPersonCode.Text) + ''')';
  If FareCode.Text = '' Then
    where[7] := '(FareCode like ''%'' or FareCode is null)'
  Else
    where[7] := '(FareCode like ''%' + trim(FareCode.Text) + '%'')';
  If WorkCode.Text = '' Then
    where[8] := '(WorkCode like ''%'' or WorkCode is null)'
  Else
    where[8] := '(WorkCode like ''%' + trim(WorkCode.Text) + '%'')';
  try
    if trim(wAccountReceivable.Text) <> '' then
      strtocurr(trim(wAccountReceivable.Text));
    if trim(wAccountReceivable2.Text) <> '' then
      strtocurr(trim(wAccountReceivable2.Text));
    if trim(wGathering.Text) <> '' then
      strtocurr(trim(wGathering.Text));
    if trim(wGathering2.Text) <> '' then
      strtocurr(trim(wGathering2.Text));
    if trim(wPayment.Text) <> '' then
      strtocurr(trim(wPayment.Text));
    if trim(wPayment2.Text) <> '' then
      strtocurr(trim(wPayment2.Text));
    if trim(wCost.Text) <> '' then
      strtocurr(trim(wCost.Text));
    if trim(wCost2.Text) <> '' then
      strtocurr(trim(wCost2.Text));
  except
    messageBox(self.Handle,'金额输入错误!','提示',MB_ICONWARNING + MB_ok);
    exit;
  end;
  If trim(wAccountReceivable.Text) <> '' Then
    where[9] := ' and (AccountReceivable >= ' + trim(wAccountReceivable.Text) + ')';
  If trim(wAccountReceivable2.Text) <> '' Then
    where[10] := ' and (AccountReceivable <= ' + trim(wAccountReceivable2.Text) + ')';  If trim(wGathering.Text) <> '' Then
    where[11] := ' and (Gathering >= ' + trim(wGathering.Text) + ')';
  If trim(wGathering2.Text) <> '' Then
    where[12] := ' and (Gathering <= ' + trim(wGathering2.Text) + ')';  If trim(wPayment.Text) <> '' Then
    where[13] := ' and (Payment >= ' + trim(wPayment.Text) + ')';
  If trim(wPayment2.Text) <> '' Then
    where[14] := ' and (Payment <= ' + trim(wPayment2.Text) + ')';  If trim(wCost.Text) <> '' Then
    where[15] := ' and (Cost >= ' + trim(wCost.Text) + ')';
  If trim(wCost2.Text) <> '' Then
    where[16] := ' and (Cost <= ' + trim(wCost2.Text) + ')';
  sqlstr := where[1];
  For i := 2 To 8 Do
    sqlstr := sqlstr + ' and  ' + where[i];
  for i := 9 to 16 do
    sqlstr := sqlstr   + where[i];    //showmessage(sqlstr);
  cReOk := true;
  close;错误提示是“标准表达式数据类型不匹配”。