Fórum Exportar TXT - Erros #405746

29/07/2011

0

Alguém pode me ajudar com esses erros:
[Error] UExporta.pas(52): There is no overloaded version of 'IntToStr' that can be called with these arguments[Error] UExporta.pas(61): Incompatible types: 'String' and 'procedure, untyped pointer or untyped parameter'[Fatal Error] ProjetoExporta.dpr(5): Could not compile used unit 'UExporta.pas'

 var  FrmExporta: TFrmExporta;
implementation
{$R *.dfm}
procedure TFrmExporta.Button1Click(Sender: TObject);var  Caminho: string; //Será Responsável pelo caminho do nosso arquivo  mArq: TextFile; //É o nosso arquivo em sibegin  cdsClientes.Open;  ProgressBar1.Max := cdsClientes.RecordCount;  Caminho := edtCaminho.Text;  AssignFile(mArq, Caminho); //Cria o Arquivo  Rewrite(mArq); {Abre para gravação}  while not cdsClientes.Eof do  begin    Writeln(marq,      Padr(Copy(IntToStr(cdsClientesCODEMPRESA.Value), 1, 4), 4, ' ') + ' ' +      Padr(Copy(cdsClientesANO.Value, 0, 4), 4, ' ') + ' ' +    { Padr(Copy(TbCustZip.Value , 1 , 10 ), 10 , ' ')             + ' ' +     Padr(Copy(TbCustCountry.Value , 1 , 20), 20 , ' ')          + ' ' +     Padr(Copy(TbCustPhone.Value, 1 , 15 ), 15 , ' ')            + ' ' +     Padr(Copy(TbCustFAX.Value, 1 , 15 ), 15 , ' ') 				 + ' ' +     Padr(Copy(FloatToStr(TbCustTaxRate.Value), 1, 6), 6 , ' ')  + ' ' +     Padr(Copy( TbCustContact.Value,  1 , 20), 20 , ' ') + ' ' +     DateToStr(TbCustLastInvoiceDate.Value));  }      Application.ProcessMessages;    cdsClientes.Next;  end;
  ShowMessage('Processo Concluído!!!');  Close;
end;
function TFrmExporta.PadR(cStr: string; nSize: Integer; cCar: string): string;var  nFor, nAux: Integer;  cAux: string;begin  cAux := Trim(cStr);  nAux := Abs(Length(cAux) - nSize) - 1;  for nFor := 0 to nAux do    cAux := cAux + cCar;  Result := cAux;end;
end.
Herdson Pereira

Herdson Pereira

Responder

Posts

29/07/2011

Marco Salles

Writeln(marq,      Padr(Copy(IntToStr(cdsClientesCODEMPRESA.Value), 1, 4), 4, ' ') + ' ' +      Padr(Copy(cdsClientesANO.Value, 0, 4), 4, ' ') + ' ' +
...........
Application.ProcessMessages;


Não esta faltando fechar o Parentesis do Writeln antes de chamar a procedure Application.ProcessMessages; ?????
Responder

Gostei + 0

29/07/2011

Herdson Pereira

Se fechar começa esses erros:
[Error] UExporta.pas(51): 'END' expected but ',' found[Error] UExporta.pas(65): Declaration expected but identifier 'ShowMessage' found[Error] UExporta.pas(68): '.' expected but ';' found[Hint] UExporta.pas(27): Private symbol 'PadR' declared but never used[Fatal Error] ProjetoExporta.dpr(5): Could not compile used unit 'UExporta.pas'
Obrigado.
Responder

Gostei + 0

29/07/2011

Marco Salles

Mas como vc esta fechando ???
Responder

Gostei + 0

29/07/2011

Herdson Pereira

Tentei um CloseFile(mArq) e CloseFile() mas continua os mesmos erros.
Desculpe pela ignorância e pelas perguntas bobas, mas é que sou leigo e estou tentando gerar um arquivo para poder importar em outra sistema.
Valeu.
Responder

Gostei + 0

29/07/2011

Marco Salles

Assim , como vc fez inicialmente , post o seu código para vermos como vc esta fechando
Responder

Gostei + 0

29/07/2011

Herdson Pereira

unit UExporta;
interface
uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, DBXpress, DB, SqlExpr, StdCtrls, ComCtrls, FMTBcd, DBClient,  Provider;
type  TFrmExporta = class(TForm)    edtCaminho: TEdit;    Button1: TButton;    Label1: TLabel;    qryClientes: TSQLQuery;    dspClientes: TDataSetProvider;    cdsClientes: TClientDataSet;    SQLConnection1: TSQLConnection;    qryClientesCODEMPRESA: TStringField;    qryClientesANO: TStringField;    cdsClientesCODEMPRESA: TStringField;    cdsClientesANO: TStringField;    ProgressBar1: TProgressBar;    procedure Button1Click(Sender: TObject);  private    { Private declarations }    function PadR(cStr: string; nSize: Integer; cCar: string): string;  public    { Public declarations }  end;
var  FrmExporta: TFrmExporta;
implementation
{$R *.dfm}
procedure TFrmExporta.Button1Click(Sender: TObject);var  Caminho: string; //Será Responsável pelo caminho do nosso arquivo  mArq: TextFile; //É o nosso arquivo em sibegin  cdsClientes.Open;  ProgressBar1.Max := cdsClientes.RecordCount;  Caminho := edtCaminho.Text;  AssignFile(mArq, Caminho); //Cria o Arquivo  Rewrite(mArq); {Abre para gravação}  while not cdsClientes.Eof do  begin    Writeln(marq,      Padr(Copy(IntToStr(cdsClientesCODEMPRESA.Value), 1, 4), 4, ' ') + ' ' +      Padr(Copy(cdsClientesANO.Value, 0, 4), 4, ' ') + ' ' +    { Padr(Copy(TbCustZip.Value , 1 , 10 ), 10 , ' ')             + ' ' +     Padr(Copy(TbCustCountry.Value , 1 , 20), 20 , ' ')          + ' ' +     Padr(Copy(TbCustPhone.Value, 1 , 15 ), 15 , ' ')            + ' ' +     Padr(Copy(TbCustFAX.Value, 1 , 15 ), 15 , ' ') 				 + ' ' +     Padr(Copy(FloatToStr(TbCustTaxRate.Value), 1, 6), 6 , ' ')  + ' ' +     Padr(Copy( TbCustContact.Value,  1 , 20), 20 , ' ') + ' ' +     DateToStr(TbCustLastInvoiceDate.Value));  }     ProgressBar1.Position := ProgressBar1.Position + 1;      Application.ProcessMessages;    cdsClientes.Next;  end;
  ShowMessage('Processo Concluído!!!');  CloseFile(marq);
end;
function TFrmExporta.PadR(cStr: string; nSize: Integer; cCar: string): string;var  nFor, nAux: Integer;  cAux: string;begin  cAux := Trim(cStr);  nAux := Abs(Length(cAux) - nSize) - 1;  for nFor := 0 to nAux do    cAux := cAux + cCar;  Result := cAux;end;
end.
Responder

Gostei + 0

29/07/2011

Decio Neto

Tira o " { " e  testa. 
Responder

Gostei + 0

29/07/2011

Decio Neto

Tira o " { " e  testa. 
Isso é pra comentar blocos no delphi vc usa tanto // pra linhas ou { bloco comentando }
Responder

Gostei + 0

29/07/2011

Decio Neto

Tira o " { " e  testa. 
Isso é pra comentar blocos no delphi vc usa tanto // pra linhas ou { bloco comentando }
Ou Writeln(marq,       Padr(Copy(IntToStr(cdsClientesCODEMPRESA.Value), 1, 4), 4, ' ') + ' ' +       Padr(Copy(cdsClientesANO.Value, 0, 4), 4, ' ')));       ProgressBar1.Position := ProgressBar1.Position + 1;       Application.ProcessMessages;     cdsClientes.Next;
Responder

Gostei + 0

29/07/2011

Herdson Pereira

Deixei assim:
 begin    Writeln(marq,      Padr(Copy(IntToStr(cdsClientesCODEMPRESA.Value), 1, 4), 4, ' ') + ' ' +      Padr(Copy(cdsClientesANO.Value, 0, 4), 4, ' ') + ' ' +      ProgressBar1.Position := ProgressBar1.Position + 1;      Application.ProcessMessages;      cdsClientes.Next;  end;
  ShowMessage('Processo Concluído!!!');  CloseFile(marq);

e fica com esses erros:
[Error] UExporta.pas(52): There is no overloaded version of 'IntToStr' that can be called with these arguments[Error] UExporta.pas(54): Incompatible types: 'String' and 'procedure, untyped pointer or untyped parameter'
Valeu!
Responder

Gostei + 0

29/07/2011

Decio Neto

Copia o meu la ta flatando fechar parenteses
Responder

Gostei + 0

29/07/2011

Herdson Pereira

Padr(Copy(IntToStr(cdsClientesCODEMPRESA.Value), 1, 4), 4, ' ') + ' ' +

Para nessa linha:
[Error] UExporta.pas(52): There is no overloaded version of 'IntToStr' that can be called with these arguments[Error] UExporta.pas(53): 'END' expected but ')' found[Error] UExporta.pas(59): Declaration expected but identifier 'ShowMessage' found[Error] UExporta.pas(62): '.' expected but ';' found[Fatal Error] ProjetoExporta.dpr(5): Could not compile used unit 'UExporta.pas'
Responder

Gostei + 0

29/07/2011

Herdson Pereira

Deixei assim e rodou: [CODE]      Padr(Copy(String(cdsClientesCODEMPRESA.Value), 1, 5), 4, ' ') + ' ' +      Padr(Copy(cdsClientesANO.Value, 1, 4), 4, ' '));
Mas está colocando dois espaços entre os campos: S0083  2010 e era para ser assim: S00832010
Ainda tem mais uns 20 campos que tenho que exportar, mas vendo isto o restante acho que dou conta, rsrsrs
Valeu.
Responder

Gostei + 0

29/07/2011

Decio Neto

O seu Codempresa no banco é inteiro?
Responder

Gostei + 0

29/07/2011

Herdson Pereira


VARCHAR 

Responder

Gostei + 0

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

Aceitar