写一个程序,要能够建档、修改、查询、列印:
数据如下:
        张一学科成绩:语文90 数学95 自然89 英语90
        李明学科成绩:语文85 数学92 自然90 英语95
        林小学科成绩:语文78 数学85 自然90 英语85
        王利学科成绩:语文92 数学75 自然95 英语80
报表格式:
      姓名  语文 数学  自然 英语 总分 平均 名次可否把代码贴出来呢,因为我目前手头上没这方面的资料,也不清楚那些控件要怎么用,或者能否给个链接(有源码)。谢谢~~~~

解决方案 »

  1.   

    报表的数据源用SQL语句写出来select 姓名,语文,数学,自然,英语,语文+数学+自然+英语 as 总分,(语文+数学+自然+英语)/4 as 平均 from 表 order by 语文+数学+自然+英语然后可以用QuickReport或者FastReport打印这个数据集如果是用 QuickReport 打印的话,DELPHI自带有例子
      

  2.   

    unit rep_qytj_fxx;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      Qrctrls, QuickRpt, ExtCtrls, Db, DBTables;type
      TFrm_rep_qyfxx = class(TForm)
        QuickRep1: TQuickRep;
        ColumnHeaderBand1: TQRBand;
        DetailBand1: TQRBand;
        PageHeaderBand1: TQRBand;
        QRLabel1: TQRLabel;
        QRLabel2: TQRLabel;
        QRSysData1: TQRSysData;
        QRShape7: TQRShape;
        QRShape8: TQRShape;
        QRShape9: TQRShape;
        QRShape10: TQRShape;
        QRShape11: TQRShape;
        QRShape12: TQRShape;
        QRDBText1: TQRDBText;
        QRDBText2: TQRDBText;
        QRDBText3: TQRDBText;
        QRDBText4: TQRDBText;
        QRDBText5: TQRDBText;
        QRDBText6: TQRDBText;
        Query1: TQuery;
        QRShape2: TQRShape;
        QRLabel8: TQRLabel;
        QRLabel7: TQRLabel;
        QRShape3: TQRShape;
        QRShape4: TQRShape;
        QRLabel6: TQRLabel;
        QRLabel5: TQRLabel;
        QRShape5: TQRShape;
        QRLabel4: TQRLabel;
        QRShape6: TQRShape;
        QRLabel3: TQRLabel;
        QRShape1: TQRShape;
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        { Private declarations }
      public
      procedure printqytjfxx;
        { Public declarations }
      end;var
      Frm_rep_qyfxx: TFrm_rep_qyfxx;implementation{$R *.DFM}
    procedure  TFrm_rep_qyfxx.printqytjfxx;
    begin
    with query1 do
      begin
      close;
      databasename:='userdata';
      SQL.clear;
      SQL.Add('select bh as 编号,jjxh as 箱号,xh as 型号,ds as 对数,xx as 线序,dz as 地址');
      SQL.Add('from db_fxx where');
      SQL.Add(SQlstring);
      open;
      end;
    end;
    procedure TFrm_rep_qyfxx.FormClose(Sender: TObject;
      var Action: TCloseAction);
    begin
        query1.Close;
    end;