导入csv
void importxls()
{
#AviFiles
str s,tempStr;
int i,cnt,fieldCount;
container c,conFilter = ["Excel Files(*.csv)", "*.csv"];
NJ_MF_RouteNumber routeNumber;
SysOperationProgress progress = new SysOperationProgress();
TextBuffer textBuffer = new TextBuffer();
;
s = WinAPI::getOpenFileName(0, conFilter, "","Open File", "", "");
if(s)
{
textBuffer.fromFile(s);
cnt = textBuffer.numLines();
c = str2con(textBuffer.nextToken(),",");
progress.setCaption("Data Import");
progress.setAnimation(#AviFormLetter);
startLengthyOperation();
for (i=0;i<cnt;i++)
{
progress.setText(strfmt("
c = str2con(textBuffer.nextToken(),',');
ttsbegin;
routeNumber.Field1 = conpeek(c,1);
routeNumber.Field2 = conpeek(c,2);
routeNumber.Field3 = conpeek(c,3);
routeNumber.Field4 = conpeek(c,4);
routeNumber.Field5 = conpeek(c,5);
routeNumber.Field6 = conpeek(c,6);
routeNumber.Field7 = conpeek(c,7);
routeNumber.Field8 = conpeek(c,8);
routeNumber.Field9 = conpeek(c,9);
routeNumber.Field10 = conpeek(c,10);
routeNumber.RouteNumber = conpeek(c,11);
routeNumber.Route = conpeek(c,12);
routeNumber.doInsert();
endLengthyOperation();
ttscommit;
}
NJ_MF_RouteNumber_Ds.research();
box::info("µ¼Èë¼Ç¼ÌõÊý£º"+int2str(i));
}
}