unit PRODPERIOD2;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, LDFORM, PrnDbgeh, DB, ADODB, ActnList, ImgList, ComCtrls,
  ExtCtrls, GridsEh, DBGridEh, ToolWin;type
  TFM_PRODPERIOD2 = class(TLDFROM)
    DBGridEh2: TDBGridEh;
    Panel1: TPanel;
    Animate2: TAnimate;
    ADOTMP: TADOQuery;
    ADOQuery1: TADOQuery;
    ADOQuery3: TADOQuery;
    DataSource1: TDataSource;
    ActionList2: TActionList;
    ADOQuery4: TADOQuery;    procedure ToolButton5Click(Sender: TObject);
    procedure dOneBeforeOpen(DataSet: TDataSet);
    procedure dOneAfterOpen(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  FM_PRODPERIOD2: TFM_PRODPERIOD2;implementation
USES DATA;
{$R *.dfm}procedure TFM_PRODPERIOD2.ToolButton5Click(Sender: TObject);
var
s_time:TDateTime;
e_time:TDateTime;
dept_ptr:String;
numberPlies:String;
ttype:String;
begin
    s_time:= Date -15;
    e_time:= Date;
with ADOQuery1 do
begin 
  if DBGridEh2.Columns[DBGridEh2.SelectedIndex].FieldName='dept_ptr' then
      ttype:=1//明细
     numberPlies: DBGridEh1.datasource.dataset.FieldByName('层数').value;
    begin
      close;
      sql.Clear;
     sql.Add('execute Wang_dept_prodtime '+quotedstr(s_time)+','+quotedstr(e_time)+','+quotedstr(dept_ptr)+','+quotedstr(层数)+','+quotedstr(ttype)'  ) ;
    end;
 else
    begin
    ttype:=2;//汇总
      close;
      sql.Clear;
      sql.Add('execute Wang_dept_prodtime '+quotedstr(s_time)+','+quotedstr(e_time)+','+quotedstr(dept_ptr)+','+quotedstr(层数)+','+quotedstr(ttype)'  ) ;
     end;
    end.
调试弹出的提示!!!Error
------------------------------------------------------------------------------------------------------------------
[Error] PRODPERIOD2.pas(62): Missing operator or semicolon
[Error] PRODPERIOD2.pas(64): Illegal character in input file: '}' ($7D)
[Error] PRODPERIOD2.pas(65): Incompatible types: 'String' and 'TDateTime'
[Error] PRODPERIOD2.pas(65): Incompatible types: 'String' and 'TDateTime'
[Error] PRODPERIOD2.pas(68): Expression expected but 'END' found
[Error] PRODPERIOD2.pas(69): ';' not allowed before 'ELSE'
[Error] PRODPERIOD2.pas(71): Incompatible types: 'String' and 'Integer'
[Error] PRODPERIOD2.pas(73): Undeclared identifier: 'sql'
[Error] PRODPERIOD2.pas(74): Missing operator or semicolon
[Error] PRODPERIOD2.pas(74): Incompatible types: 'String' and 'TDateTime'
[Error] PRODPERIOD2.pas(74): Incompatible types: 'String' and 'TDateTime'
[Error] PRODPERIOD2.pas(74): Illegal character in input file: '层' ($B2E3)
[Error] PRODPERIOD2.pas(74): Unterminated string
[Error] PRODPERIOD2.pas(78): ';' expected but '.' found
[Error] PRODPERIOD2.pas(160): Declaration expected but end of file found
[Error] PRODPERIOD2.pas(23): Unsatisfied forward or external declaration: 'TFM_PRODPERIOD2.dOneBeforeOpen'
[Error] PRODPERIOD2.pas(24): Unsatisfied forward or external declaration: 'TFM_PRODPERIOD2.dOneAfterOpen'
[Fatal Error] data.pas(334): Could not compile used unit 'PRODPERIOD2.pas'