我是学DELPHI才几天的初学者,因为有急用,需要马上把通过别人给我的一个PAS文件生成一个EXE文件。如果我直接把这个PAS文件复制到DELPHI中保存的话,会显示Field Form1.Button1 does not have a corresponding component.Remove the declaration?
如果我直接点NO非要保存的话,保存下来也不能生成EXE 文件。
请高手指点一下,非常感谢

解决方案 »

  1.   

    你可以考虑参照Pas文件做一个对应的dfm文件,上面按照PAS文件里面摆摆控件吧。比方type
     
        Label11: TLabel;
      
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    那你相应的在FORM上摆上就可以
      

  2.   

    不好意思,就是因为我学DELPHI确实才只有两天而已所以摆控件都只了解了书上那两个。能不能哪位好心人花点时间帮我摆摆,然后把所有生成的源程序一起打包发给我。
    确实因为时间比较紧才出此下策,回去一定好好学习DELPHI。
    PAS源程序如下:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, dxCntner, dxEditor,
      dxExEdtr, dxEdLib, dxDBELib, ComCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        ADOConnection1: TADOConnection;
        ADOQuery1: TADOQuery;
        GroupBox1: TGroupBox;
        DateTimePicker2: TDateTimePicker;
        DateTimePicker1: TDateTimePicker;
        Label1: TLabel;
        RadioButton2: TRadioButton;
        RadioButton3: TRadioButton;
        Label2: TLabel;
        RadioButton1: TRadioButton;
        ComboBox1: TComboBox;
        ComboBox2: TComboBox;
        GroupBox2: TGroupBox;
        Button1: TButton;
        Edit1: TEdit;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure RadioButton2Click(Sender: TObject);
        procedure RadioButton3Click(Sender: TObject);
        procedure RadioButton1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
      cs,datestr1,datestr2:string;
    begin
        cs:='select count(*) as tmpjs from 馆藏典藏库 as a where';
        datestr1:=datetostr(datetimepicker1.date);
        datestr2:=datetostr(datetimepicker2.date);
        if datetimepicker2.date<datetimepicker1.date then
        begin
         edit1.Text:='日期选择有误!';
         exit;
        end;
        if datetimepicker2.date=datetimepicker1.date then
          cs:=cs+' a.处理时间>=convert(smalldatetime,'''+datestr1+' 00:00:00'')'+' and a.处理时间<convert(smalldatetime,'''+datestr1+' 23:59:59'')';
        if datetimepicker2.date>datetimepicker1.date then
          cs:=cs+' a.处理时间>=convert(smalldatetime,'''+datestr1+' 00:00:00'')'+' and a.处理时间<convert(smalldatetime,'''+datestr2+' 23:59:59'')';
      //edit1.Text:=cs;
      //exit;
      if radiobutton1.Checked then
      begin
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(cs);
        adoquery1.Open;
        edit1.Text:=adoquery1.fieldbyname('tmpjs').AsString;
      end;
      if radiobutton2.Checked then
      begin
        cs:=cs+' and (a.操作员='+copy(combobox1.Text,1,4)+')';
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(cs);
        adoquery1.Open;
        edit1.Text:=adoquery1.fieldbyname('tmpjs').AsString;
      end;
      if radiobutton3.Checked then
      begin
        cs:=cs+' and (';
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from 系统用户信息 where 工作部门='''+trim(combobox2.Text)+'''');
        adoquery1.Open;
        while not adoquery1.Eof do
        begin
          cs:=cs+' a.操作员='+adoquery1.fieldbyname('用户代码').AsString;
          adoquery1.Next;
          if not adoquery1.Eof then cs:=cs+' or ';
        end;
        cs:=cs+')';
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add(cs);
        adoquery1.Open;
        edit1.Text:=adoquery1.fieldbyname('tmpjs').AsString;
        //edit1.Text:=cs;
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    var
      cs:string;
    begin
      datetimepicker1.DateTime:=now();
      datetimepicker2.DateTime:=now();
      cs:='Provider=SQLOLEDB.1;Password=goldlibgdlis;Persist Security Info=True;User ID=sa;Initial Catalog=GdlisXP;Data Source=211.83.192.214;';
      cs:=cs+'Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WXP2000S;Use Encryption for Data=False;Tag with column collation when possible=False';
      adoconnection1.ConnectionString:=cs;
      adoconnection1.Connected:=true;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select * from 系统用户信息 order by 用户代码');
      adoquery1.Open;
      while not adoquery1.Eof do
      begin
        combobox1.Items.Add(adoquery1.Fieldbyname('用户代码').AsString+stringofchar(' ',4-length(adoquery1.Fieldbyname('用户代码').AsString))+adoquery1.Fieldbyname('姓名').AsString);
        adoquery1.Next;
      end;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select 工作部门 from 系统用户信息 group by 工作部门');
      adoquery1.Open;
      while not adoquery1.Eof do
      begin
        combobox2.Items.Add(adoquery1.Fieldbyname('工作部门').AsString);
        adoquery1.Next;
      end;
      combobox1.ItemIndex:=0;
      combobox2.ItemIndex:=0;
      adoquery1.Close;
    end;procedure TForm1.RadioButton2Click(Sender: TObject);
    begin
      combobox1.Enabled:=true;
      combobox2.Enabled:=false;
    end;procedure TForm1.RadioButton3Click(Sender: TObject);
    begin
      combobox2.Enabled:=true;
      combobox1.Enabled:=false;
    end;procedure TForm1.RadioButton1Click(Sender: TObject);
    begin
      combobox1.Enabled:=false;
      combobox2.Enabled:=false;
    end;end.
      

  3.   

    其实是一个在SQL数据库中执行查询的一个程序,先选择一个时间段,然后选择是对“个人”、“部门”还是“全馆”的人进行统计。如是个人就还要选择这个人是号码,号码在数据库中查询出来。整个是统计人员做的工作量
      

  4.   

    最简单的办法:找给你pas文件的人把源码要全了,除非他是故意刁难你,否则不会只给pas
      

  5.   

    其实我是有这个源程序的EXE文件的,我之所以还要这么费事的想得到它的所有源程序是想在这个源程序上做一些小小的改动,然后生成一个新的源程序。如果哪位好心人愿意帮忙我可以把这个本身的EXE程序发给你,小女子无限感激了
      

  6.   

    小女子无限感激了
    ---------
    你一早说你是MM,楼上的全部都抢着帮你了 :D
      

  7.   

    哈哈,有意思.
    找給你PAS的人哦...不給就呆在他家不走^_^
      

  8.   

    在Form1上加15个组件!对一个刚学几天的人来说可能不容易,特别是前5个:    ADOConnection1: TADOConnection;
        ADOQuery1: TADOQuery;
        GroupBox1: TGroupBox;
        DateTimePicker2: TDateTimePicker;
        DateTimePicker1: TDateTimePicker;另外,每个组件要进行各种属性设置,在unit中是看不出来的.
      

  9.   

    我也认为最好的办法是找给你Unit的人,
    把project1全套文件(6个,编译后为8个)一起要来.