Delphi成绩表打印

时间:2018-07-15 10:15:18
【文件属性】:

文件名称:Delphi成绩表打印

文件大小:460KB

文件格式:RAR

更新时间:2018-07-15 10:15:18

deiphi

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DB, ADODB, OleServer, Excel2000, ExtCtrls, Grids, DBGrids; type TForm1 = class(TForm) ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; DataSource1: TDataSource; DBGrid1: TDBGrid; Label1: TLabel; Edit1: TEdit; Label2: TLabel; Edit2: TEdit; ComboBox1: TComboBox; Button1: TButton; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public end; var Form1: TForm1; implementation uses Unit2; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin ADOQuery1.Close; ADOQuery1.SQL.Clear; if edit2.Text='13440101' then begin if combobox1.Text='全部学期' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where xm=:sxm and xh=:sxh '); ADOQuery1.Parameters.ParamByName('sxm').Value := Edit1.Text; ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Open end; if combobox1.Text='第一学期' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where xm=:sxm and xh=:sxh and xq=:sxq '); ADOQuery1.Parameters.ParamByName('sxm').Value := Edit1.Text; ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Parameters.ParamByName('sxq').Value :='1'; ADOQuery1.Open end; if combobox1.Text='第二学期' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where xm=:sxm and xh=:sxh and xq=:sxq '); ADOQuery1.Parameters.ParamByName('sxm').Value := Edit1.Text; ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Parameters.ParamByName('sxq').Value :='2'; ADOQuery1.Open end; if combobox1.Text='第三学期' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where xm=:sxm and xh=:sxh and xq=:sxq '); ADOQuery1.Parameters.ParamByName('sxm').Value := Edit1.Text; ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Parameters.ParamByName('sxq').Value :='3'; ADOQuery1.Open end; if combobox1.Text='第四学期' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where xm=:sxm and xh=:sxh and xq=:sxq '); ADOQuery1.Parameters.ParamByName('sxm').Value := Edit1.Text; ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Parameters.ParamByName('sxq').Value :='4'; ADOQuery1.Open end; end; if edit2.Text='13440102' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where xm=:sxm and xh=:sxh and xq=:sxq'); ADOQuery1.Parameters.ParamByName('sxm').Value := Edit1.Text; ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Parameters.ParamByName('sxq').Value :='1'; ADOQuery1.Open end; dbgrid1.Columns.Items[0].Width:=60; dbgrid1.Columns.Items[1].Width:=60; dbgrid1.Columns.Items[2].Width:=60; dbgrid1.Columns.Items[3].Width:=150; dbgrid1.Columns.Items[4].Width:=80; dbgrid1.Columns.Items[5].Width:=60; dbgrid1.Columns.Items[6].Width:=60; dbgrid1.Columns.Items[7].Width:=60; dbgrid1.Columns.Items[8].Width:=60; dbgrid1.Columns.Items[9].Width:=60; dbgrid1.Columns.Items[10].Width:=60; end; procedure TForm1.Button2Click(Sender: TObject); begin ADOQuery1.Close; ADOQuery1.SQL.Clear; if edit2.Text='13440101' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where cj<60 and xh=:sxh'); ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Open; end; if edit2.Text='13440102' then begin ADOQuery1.SQL.Add('Select * From 13440101 Where cj<60 and xh=:sxh'); ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; ADOQuery1.Open; end; dbgrid1.Columns.Items[0].Width:=60; dbgrid1.Columns.Items[1].Width:=60; dbgrid1.Columns.Items[2].Width:=60; dbgrid1.Columns.Items[3].Width:=150; dbgrid1.Columns.Items[4].Width:=80; dbgrid1.Columns.Items[5].Width:=60; dbgrid1.Columns.Items[6].Width:=60; dbgrid1.Columns.Items[7].Width:=60; dbgrid1.Columns.Items[8].Width:=60; dbgrid1.Columns.Items[9].Width:=60; dbgrid1.Columns.Items[10].Width:=60; end; procedure TForm1.Button3Click(Sender: TObject); begin form1.ADOQuery1.Close; form1.ADOQuery1.SQL.Clear; form1.ADOQuery1.SQL.Add('Select xh From xsmessage Where xh=:sxh'); form1.ADOQuery1.Parameters.ParamByName('sxh').Value := Edit2.Text; form1.ADOQuery1.Open; form2.qrdbtext1.DataField:='xh'; form2.quickrep1.Preview; end; procedure TForm1.FormCreate(Sender: TObject); begin end; end.


【文件预览】:
成绩表 打印
----Unit1.ddp(51B)
----Project1.res(876B)
----Unit2.dcu(5KB)
----Unit1.dcu(10KB)
----Unit2.~pas(1KB)
----Unit1.~ddp(51B)
----Unit2.pas(1KB)
----Unit1.dfm(5KB)
----Project1.~dpr(188B)
----Project1.cfg(446B)
----Project1.dpr(263B)
----Unit1.~dfm(5KB)
----Project1.exe(1.22MB)
----Unit2.~ddp(51B)
----Project1.dof(2KB)
----Unit1.~pas(5KB)
----Unit2.ddp(51B)
----Unit1.pas(5KB)
----Unit2.dfm(17KB)
----Unit2.~dfm(17KB)

网友评论