变量<br> ts :tstrings;<br> s :STRING;<br> f :textfile;<br> i :integer;<br> linecounts:integer; //总行数<br> currentline:integer; //当前行数<br><br>程序<br> linecounts := 0; //总行数<br> currentline := 0; //当前行数<br>assignfile(f, filename);<br>reset(f);<br>WHILE NOT eof(f) DO<br> BEGIN<br> readln(f, s);<br> APPLICATION.ProcessMessages;<br> inc(linecounts);<br> StatusBar1.Panels.Items[1].Text := '正在估计数据量大小……';<br>END;<br>reset(f);<br>WHILE NOT eof(f) DO<br> BEGIN<br> readln(f, s);<br> ts.Delimiter := Delimiter[1];<br> ts.DelimitedText := s;<br> //清空空行数据<br> FOR i := 0 DOWNTO ts.count - 1 DO<br> IF ts.strings = '' THEN<br> ts.Delete(i);<br> showmessage(ts.CommaText);<br> //数组里放数据<br><br> inc(currentline);<br> application.ProcessMessages;<br><br> IF currentline <> linecounts THEN<br> StatusBar1.Panels.Items[1].Text := '当前处理数据:' +<br> inttostr(currentline) + '/总数据量' + inttostr(linecounts)<br> ELSE<br> StatusBar1.Panels.Items[1].Text := inttostr(linecounts) +<br> '条记录已经处理完毕!';<br> StatusBar1.Panels.Items[2].Text := '数据库中共有' +<br> inttostr(datasource1.DataSet.RecordCount) + '条记录';<br> END;<br> adoquery1.Open;<br>FINALLY<br> result := true;<br> closefile(f);<br> ts.Free;<br> END;