static void commaIoRead(Args _args)
{
#File
Dialog dialog = new Dialog("Importer");
DialogField dialogFieldCaminho;
CommaIo commaIo;
FileIoPermission fileIoPermission;
Container filtro = ["txt", #AllFilesName+#txt], readCon;
TimesFutebol timesFutebol; //Table Buffer
;
dialog.filenameLookupFilter(filtro);
dialogFieldCaminho = dialog.addField(TypeId(FileNameOpen), "Select");
if(dialog.run())
{
fileIoPermission = new fileIoPermission(dialogFieldCaminho.value(), #io_read);
fileIoPermission.assert();
commaIo = new CommaIo(dialogFieldCaminho.value(), #io_read);
commaIo.inFieldDelimiter(";");
if(commaIo)
{
try
{
while(commaIo.status() == IO_Status::Ok)
{
readCon = commaIo.read();
if(conlen(readCon) > 0)
{
ttsbegin;
timesFutebol.IdTime = conpeek(readCon, 1);
timesFutebol.NomeTime = conpeek(readCon,2);
timesFutebol.insert();
ttscommit;
}
}
info("import success");
}
catch(Exception::Error)
{
throw error("Error in impoting");
}
}
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.