📄 mddyunit.pas
字号:
unit mddyunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,datadomule, DB, DBTables;
type
Tmddy = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Button1: TButton;
qry: TQuery;
DataSource1: TDataSource;
procedure ComboBox1Exit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
mddy: Tmddy;
implementation
uses mddyfrmunit;
{$R *.dfm}
procedure Tmddy.ComboBox1Exit(Sender: TObject);
begin
combobox2.Items.Clear;
with datamodule1.qry_bycp do
begin
close;
sql.Clear;
sql.add('select * from bjb0 where zymc=:name');
parambyname('name').asstring:=combobox1.text;
open;
if recordcount>0 then
combobox2.text:=Fields[0].asstring;
repeat
combobox2.items.add(fields[0].asstring);
until findnext=false;
end;
end;
procedure Tmddy.FormCreate(Sender: TObject);
begin
combobox1.Items.clear;
with datamodule1.qry_bycp do
begin
close;
sql.clear;
sql.add('select * from zyb0') ;
open;
first;
if recordcount>0 then
// combobox1.text:=Fields[1].asstring;
repeat
combobox1.items.add(fields[1].asstring);
until findnext=false;
end;
end;
procedure Tmddy.Button1Click(Sender: TObject);
var i,k,j:integer;
begin
i:=0;
k:=1;
j:=129;
with qry do
begin
close;
sql.Clear ;
sql.Add('select * from xsmc where bjh0=:id');
parambyname('id').asstring:=combobox2.text;
qry.Open;
end;
with datamodule1.qry_mddy do
begin
close;
sql.Clear ;
sql.add('delete from mddy');
execsql;
sql.Clear ;
sql.add('select * from mddy');
execsql;
open;
end;
while k<=qry.RecordCount do
begin
datamodule1.qry_mddy.edit;
datamodule1.qry_mddy.Fields[j].AsString:=inttostr(k);
k:=k+1;
j:=j+1;
end;
datamodule1.qry_mddy.post;
while not qry.Eof do
begin
datamodule1.qry_mddy.edit;
datamodule1.qry_mddy.Fields[i].AsString:=qry.Fields[0].asstring;
if qry.Fields[6].asstring='男' then
begin
datamodule1.qry_mddy.Fields[i+1].AsString:='';
end
else
begin
datamodule1.qry_mddy.Fields[i+1].AsString:=qry.Fields[6].asstring;
end;
datamodule1.qry_mddy.Fields[i+2].AsString:=qry.Fields[5].asstring;
qry.Next;
i:=i+3;
end;
datamodule1.qry_mddy.Post;
mddyfrm:=tmddyfrm.create(self);
mddyfrm.showmodal;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -