Источник:
http://feedproxy.google.com/~r/daxbr/~3/9c7WRdEFy_A/
==============
Caros,
Segue uma base de ceps mais atual com 1.345.486 ceps, já no formato para ser importada.
zips_20111206.rar
Abaixo o código para fazer a importação:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
static void loadCepsFromFile
(Args _args
) { AddressZipCode buffer; Dialog dialog; DialogField dfFileName; TextIO inFile; RecordInsertList recordInsert
= new RecordInsertList
(tableNum(AddressZipCode
));
Container line; ;
delete_from buffer; dialog
= new Dialog
("Selecione o arquivo"); dfFileName
= dialog.
addField(typeId(FilenameOpen
), "Selecione o arquivo");
if(!dialog.
run()) return; inFile
= new TextIO
(dfFileName.
value(), 'R'); inFile.
inFieldDelimiter(";"); line
= inFile.
read();
while(line
) { line
= infile.
read();
if (line
) { buffer.
ZipCode = conpeek(line
,1); buffer.
City = conpeek(line
,2); buffer.
StreetName = conpeek(line
,3); buffer.
CountryRegionId = conpeek(line
,4); buffer.
State = conpeek(line
,5); buffer.
CityAlias = conpeek(line
,6); buffer.
DistrictName = conpeek(line
,7); recordInsert.
add(buffer
); line
= inFile.
read();
} } recordInsert.
insertDatabase();
}
[]s
Pichler
Источник:
http://feedproxy.google.com/~r/daxbr/~3/9c7WRdEFy_A/