Fórum Copiar entre pastas #301085

28/10/2005

0

Pessoal tenho o seguinte proceimento

procedure TFrmEmpresa.BtnOkClick(Sender: TObject);
begin
IF Status = ´I´ then
Begin
TblEmpresa.Append;
TblEmpresaCodigo.Text := MskCodigo.Text;
TblEmpresaNome.Text := MskDescricao.text;
TblEmpresaEndereco.Text := MskEndereco.Text;
TblEmpresaBairro.Text := MskBairro.Text;
TblEmpresaMunicipio.Text := MskCidade.Text;
TblEmpresaEstado.Text := MskEstado.Text;
TblEmpresaCep.Text := MskCEP.Text;
TblEmpresaCGC.Text := MskCnpj.Text;
TblEmpresaInsEst.text := MskInscricao.Text;
TblEmpresaTitular.Text := MskTitular.Text;
TblEmpresaContador.Text := MskContador.Text;
TblEmpresaCRC.Text := MskCRC.Text;
TblEmpresaUF.Text := MskUfCRC.Text;
TblEmpresaLvd.Value := MskNDiario.Value;
TblEmpresaLvr.VAlue := MskNRazao.Value;
TblEmpresaUpag.Value := MskUltPag.Value;
TblEmpresaAnoBase.Text := MskAnoBase.Text;
TblEmpresaUcod.VAlue := MskUltRed.Value;
TblEmpresaGrau_1.text := MskNivel1.Text;
TblEmpresaGrau_2.Text := MskNivel2.Text;
TblEmpresaGrau_3.Text := MskNIvel3.Text;
TblEmpresaGrau_4.Text := MskNivel4.text;
TblEmpresaGrau_5.Text := MskNivel5.Text;
TblEmpresaGrau_6.Text := MskNivel6.Text;
TblEmpresaUltCopia.Text := DateToStr(DATE());
TblEmpresa.Post;
Criar;
TblEmpresa.Refresh;

TblTrava.Append;
TblTravaCodigo.Text := TblEmpresaCodigo.text;
TblTravaAno.Text := TblEmpresaAnoBase.text;
TblTrava.Post;

Limpa;

MskCodigo.SetFocus;
end;
If Status = ´A´ then
begin
TblEmpresa.Edit;
TblEmpresaCodigo.Text := MskCodigo.Text;
TblEmpresaNome.Text := MskDescricao.text;
TblEmpresaEndereco.Text := MskEndereco.Text;
TblEmpresaBairro.Text := MskBairro.Text;
TblEmpresaMunicipio.Text := MskCidade.Text;
TblEmpresaEstado.Text := MskEstado.Text;
TblEmpresaCep.Text := MskCEP.Text;
TblEmpresaCGC.Text := MskCnpj.Text;
TblEmpresaInsEst.text := MskInscricao.Text;
TblEmpresaTitular.Text := MskTitular.Text;
TblEmpresaContador.Text := MskContador.Text;
TblEmpresaCRC.Text := MskCRC.Text;
TblEmpresaUF.Text := MskUfCRC.Text;
TblEmpresaLvd.Value := MskNDiario.Value;
TblEmpresaLvr.VAlue := MskNRazao.Value;
TblEmpresaUpag.Value := MskUltPag.Value;
TblEmpresaAnoBAse.Text := MskAnoBase.Text;
TblEmpresaUcod.VAlue := MskUltRed.Value;
TblEmpresaGrau_1.text := MskNivel1.Text;
TblEmpresaGrau_2.Text := MskNivel2.Text;
TblEmpresaGrau_3.Text := MskNIvel3.Text;
TblEmpresaGrau_4.Text := MskNivel4.text;
TblEmpresaGrau_5.Text := MskNivel5.Text;
TblEmpresaGrau_6.Text := MskNivel6.Text;

TblEmpresa.post;
Status := ´´;
DbgEmpresa.Visible := True;
BtnIncluir.Visible := True;
BtnAlterar.Visible := True;
BtnDeletar.Visible := True;
BtnFim.Visible := True;
BtnOk.Visible := False;
BtnCancelar.Visible := False;
END;

end;

Bem, dentro deste procedimento quero copiar um arquivo de uma pasta para outra (c:\origem\prec.db para c:\destino\prec.db) tentei usar o comando copytofile..., mas por algum motivo não consigo, gostaria da ajuda dos amigos

Eva


Eva

Eva

Responder

Posts

28/10/2005

Fabiano Góes

olá EVA , como vai ? e o ´ADãO´ está bem :lol:
brincadeira :!:

Você já tentou:
CopyFile(PChar(´C:\PastaOrigem\Arquivo´),Pchar(´C:\PastaDestino\Arquivo´), False);


tenho usado assim e sempre tem funcionado.

espero ter te ajudado.

um grande abraço !!!!


Responder

Gostei + 0

28/10/2005

Emerson Nascimento

procedure TFrmEmpresa.BtnOkClick(Sender: TObject); 
begin 
  if Status = ´I´ then
    TblEmpresa.Append;
  else
  if Status = ´A´ then
    TblEmpresa.Edit;

  if TblEmpresa.Status in [dsEdit, dsInsert] then
  begin 
    TblEmpresaCodigo.Text := MskCodigo.Text; 
    TblEmpresaNome.Text := MskDescricao.text; 
    TblEmpresaEndereco.Text := MskEndereco.Text; 
    TblEmpresaBairro.Text := MskBairro.Text; 
    TblEmpresaMunicipio.Text := MskCidade.Text; 
    TblEmpresaEstado.Text := MskEstado.Text; 
    TblEmpresaCep.Text := MskCEP.Text; 
    TblEmpresaCGC.Text := MskCnpj.Text; 
    TblEmpresaInsEst.text := MskInscricao.Text; 
    TblEmpresaTitular.Text := MskTitular.Text; 
    TblEmpresaContador.Text := MskContador.Text; 
    TblEmpresaCRC.Text := MskCRC.Text; 
    TblEmpresaUF.Text := MskUfCRC.Text; 
    TblEmpresaLvd.Value := MskNDiario.Value; 
    TblEmpresaLvr.VAlue := MskNRazao.Value; 
    TblEmpresaUpag.Value := MskUltPag.Value; 
    TblEmpresaAnoBase.Text := MskAnoBase.Text; 
    TblEmpresaUcod.VAlue := MskUltRed.Value; 
    TblEmpresaGrau_1.text := MskNivel1.Text; 
    TblEmpresaGrau_2.Text := MskNivel2.Text; 
    TblEmpresaGrau_3.Text := MskNIvel3.Text; 
    TblEmpresaGrau_4.Text := MskNivel4.text; 
    TblEmpresaGrau_5.Text := MskNivel5.Text; 
    TblEmpresaGrau_6.Text := MskNivel6.Text; 
    TblEmpresaUltCopia.Text := DateToStr(DATE()); 
    TblEmpresa.Post;

    if Status = ´I´ then
    begin
      Criar; 
      TblEmpresa.Refresh; 

      TblTrava.Append; 
      TblTravaCodigo.Text := TblEmpresaCodigo.text; 
      TblTravaAno.Text := TblEmpresaAnoBase.text; 
      TblTrava.Post; 

      Limpa; 
      MskCodigo.SetFocus; 
    end
    else
    if Status = ´A´ then 
    begin 
      Status := ´´; 
      DbgEmpresa.Visible := True; 
      BtnIncluir.Visible := True; 
      BtnAlterar.Visible := True; 
      BtnDeletar.Visible := True; 
      BtnFim.Visible := True; 
      BtnOk.Visible := False; 
      BtnCancelar.Visible := False; 
    end;
  end;

  // não sobrepõe caso o arquivo destino exista
  CopyFile(´c:\origem\prec.db´,´c:\destino\prec.db´,TRUE) 

  // sobrepõe o arquivo destino caso exista
  CopyFile(´c:\origem\prec.db´,´c:\destino\prec.db´,FALSE)

end;



Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar