📄 unit3.pas
字号:
dbedit5.Text:=tempdepart;
dbedit1.Text:=tempnumber;
table1.Post;
end
else
showmessage('该医师已经存在');
end
else
showmessage('部门名称或姓名过长');
end
else
showmessage('输入的医师编号不合法');
end
else
showmessage('请输入想添加的医师编号');
end;
procedure Tdomanager.Button4Click(Sender: TObject);
var
sex: variant;
maname:variant;
birth:variant;
part:variant;
begin
if radiobutton1.Checked=true
then
sex:='男'
else
sex:='女';
if(edit4.Text<>'')or(edit5.Text<>'')or(edit6.Text<>'')
then
begin
if (edit4.Text<>'')and(edit5.Text<>'')and(edit6.Text<>'')
then
begin
if unit4.searchdo.Isdataok(edit4.Text,edit5.Text,edit6.Text)=True
then
birth:=edit4.Text+'-'+edit5.Text+'-'+edit6.Text
else
begin
showmessage('你输入的出生日期不正确');
birth:='';
end;
end
else
begin
birth:='';
showmessage('你输入的出生日期不完整,出生年月将按缺省为空处理');
end;
end
else
begin
birth:='';
//showmessage('你未输入的出生日期,出生年月将按缺省为空录入');
end;
maname:=edit2.Text;
part:=edit3.Text;
// table1.Filtered:=false;
if edit1.Text<>''
then
begin
table1.Filter:='医师编号='''+edit1.Text+'''';
table1.Filtered:=true;
end
else
begin
table1.Filter:='性别='''+sex+'''';
if maname<>''
then
begin
table1.Filter:=table1.Filter+'and 姓名='''+maname+'''' ;
table1.Filtered:=true;
end;
if birth<>''
then
begin
table1.Filter:=table1.Filter+'and 出生日期='''+birth+'''' ;
table1.Filtered:=true;
end;
if part<>''
then
begin
table1.Filter:=table1.Filter+'and 所属部门='''+part+'''' ;
table1.Filtered:=true;
end;
end;
if (DBEdit1.Text='')
then
begin
showmessage('未找到相应的医务管理员');
end;
end;
procedure Tdomanager.Button5Click(Sender: TObject);
begin
table1.Close;
table1.Filter:='';
table1.Filtered:=false;
table1.Open;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
end; }
procedure TForm3.Button2Click(Sender: TObject);
var
str:string;
i:integer;
count:integer;
count1:integer;
str1:string;
begin
a:=0;
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info ';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
count:=adoquery1.RecordCount;
for i:=1 to count+1
do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
count1:=adoquery1.RecordCount;
if (count1=0 )
then
begin
a:=i;
end;
end;
if radiobutton1.Checked=true
then
begin
str1:='是';
end
else
str1:='否';
str:='insert into info (户主姓名,楼栋,户号,身份证号,编号,家庭电话,手机,工作单位,是否长住) values('''+edit2.Text+''','''+edit4.Text+''','''+edit5.Text+''','''+edit3.Text+''','''+inttostr(a)+''','''+edit6.Text+''','''+edit7.Text+''','''+edit8.Text+''','''+str1+''')' ;
adoquery1.Close;
adoquery1.SQL.Clear;
// str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Append;
str:='select * from info';
adoquery1.Close;
adoquery1.SQL.Clear;
// str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
end;
{
adotable1.ReadOnly:=false;
adotable1.Close;
adotable1.Append;
adotable1.Post; }
{dbedit2.ReadOnly:=false;
dbedit3.ReadOnly:=false;
dbedit4.ReadOnly:=false;
dbedit5.ReadOnly:=false;
dbedit6.ReadOnly:=false;
dbedit7.ReadOnly:=false;
dbedit8.ReadOnly:=false;
dbedit9.ReadOnly:=false;
dbedit1.ReadOnly:=false;
}
//adotable1.ReadOnly:=true;
//adotable1.Append;
procedure TForm3.Button1Click(Sender: TObject);
var
str:string;
i:integer;
count:integer;
count1:integer;
str1:string;
str2:string;
begin
if radiobutton1.Checked=true
then
begin
str1:='是';
end
else
str1:='否';
if edit1.Text<>''
then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 编号='''+edit1.Text+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
count:=adoquery1.RecordCount;
if (count>0)
then
begin
str:='update info set 户主姓名 ='''+ edit2.Text+''' , '+' 楼栋= '''+edit4.Text+''' , '+' 户号='''+edit5.Text+''' , '+' 身份证号= '''+edit3.Text+''' , '+' 家庭电话='''+edit6.Text+''' , '+'手机=''' +edit7.Text+''' , '+' 工作单位='''+edit8.text+''' , '+' 是否长住='''+str1+''' where 编号='''+edit1.Text+'''';
adoquery1.Close;
adoquery1.SQL.Clear;
// str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Append;
str:='select * from info';
adoquery1.Close;
adoquery1.SQL.Clear;
// str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
end
else
showmessage('该用户不存在');
end;
end;
procedure TForm3.Button5Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from info');
adoquery1.ExecSQL;
//adoquery1.Active:=true;
adoquery1.Open;
end;
procedure TForm3.Button3Click(Sender: TObject);
var
str:string;
flag:string;
begin
str:='';
if edit1.Text<>''
then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 编号='''+edit1.Text+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
//adoquery1.Active:=true;
adoquery1.Open;
end
else if (edit4.Text<>'') and (edit5.Text<>'')
then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 楼栋='''+edit4.Text+''''+'and 户号 ='''+ edit5.Text+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Active:=true;
adoquery1.Open;
end
else if (edit2.Text<>'')
then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 户主姓名='''+edit2.Text+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Active:=true;
adoquery1.Open;
end
else if (edit3.Text<>'')
then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 身份证号='''+edit2.Text+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Active:=true;
adoquery1.Open;
end
else
begin
if radiobutton1.Checked=true
then
begin
flag :='是';
end
else flag:='否';
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 是否长住='''+flag+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Active:=true;
adoquery1.Open;
end;
end;
procedure TForm3.Button4Click(Sender: TObject);
var
str:string;
i:integer;
count:integer;
count1:integer;
str1:string;
str2:string;
begin
if radiobutton1.Checked=true
then
begin
str1:='是';
end
else
str1:='否';
if edit1.Text<>''
then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
str:='select * from info where 编号='''+edit1.Text+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
count:=adoquery1.RecordCount;
if (count>0)
then
begin
str:='delete from info where 编号='''+edit1.Text+'''';
adoquery1.Close;
adoquery1.SQL.Clear;
// str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
// adoquery1.Append;
str:='select * from info';
adoquery1.Close;
adoquery1.SQL.Clear;
// str:='select * from info where 编号='''+inttostr(i)+'''';
adoquery1.SQL.Add(str);
adoquery1.ExecSQL;
adoquery1.Open;
end
else
showmessage('该用户不存在');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -