Para quem tentar criar uma espécie de agenda médica, barbeiro, cabelereira, etc..
Minha contribuição para a humanidade.
Usei o Zeos como conector de banco de dados.
procedure TForm1.Button1Click(Sender: TObject);
var
xPROFISSIONAL:string;
xDATA:TDateTime;
xHORA:TDatetime;
begin
xPROFISSIONAL:= edit1.text;
xDATA:= cxDateEdit1.Date;
xHORA:= cxTimeEdit1.Time;
with ZQuery1 do
begin
close;
sql.clear;
sql.Text:='select * from tbl_consulta';
SQL.Add('where medico = :pPROFISSIONAL');
SQL.Add('AND dt_atendimento = :pDATA');
SQL.Add('AND hr_atendimento= :pHORA');
SQL.Add('ORDER BY hr_atendimento');
ParamByName('pPROFISSIONAL').AsString :=xPROFISSIONAL;
ParamByName('pDATA').Value := xData;
ParamByName('pHORA').Value := xHORA;
open;
if not ZQuery1.IsEmpty then
begin
ShowMessage('Este nome já existe na base.');
end
else
begin
//Seus comandos de Inclusão;
ZQuery1.Insert;
ZQuery1medico.Value := StrToInt(Edit1.Text);
ZQuery1dt_atendimento.Value := xData;
ZQuery1hr_atendimento.Value := xHORA;
ZQuery1.Post;
end;
end;
end;
Nenhum comentário:
Postar um comentário