Fórum Exportar TXT - Erros #405746
29/07/2011
0
[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
Curtir tópico
+ 0Posts
29/07/2011
Marco Salles
...........
Application.ProcessMessages;
Não esta faltando fechar o Parentesis do Writeln antes de chamar a procedure Application.ProcessMessages; ?????
Gostei + 0
29/07/2011
Herdson Pereira
[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.
Gostei + 0
29/07/2011
Marco Salles
Gostei + 0
29/07/2011
Herdson Pereira
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.
Gostei + 0
29/07/2011
Marco Salles
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.Gostei + 0
29/07/2011
Decio Neto
Gostei + 0
29/07/2011
Decio Neto
Gostei + 0
29/07/2011
Decio Neto
Gostei + 0
29/07/2011
Herdson Pereira
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!
Gostei + 0
29/07/2011
Decio Neto
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'
Gostei + 0
29/07/2011
Herdson Pereira
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.
Gostei + 0
29/07/2011
Decio Neto
Gostei + 0
29/07/2011
Herdson Pereira
VARCHAR
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)