你好象没有清空s,应该:while not Table1.Eof do begin
     S:='';  // <---------加上这句。
      S := S + Table1.FieldByName('序号').AsString +',';

解决方案 »

  1.   

    如果象我说的清空了s之后还出现的话,干脆直接操纵文件,肯定行,这样:
    var
      S: string;
      F : TextFile;
    begin
      Screen.Cursor := crHourGlass;
      Button2.Enabled := False;  AssignFile(F, 'pq.txt');
      {$I-}
      Rewrite(F);
      {$I+}  try
        Table1.Open;
        while not Table1.Eof do begin
          S := '';
     
          S := S + Table1.FieldByName('序号').AsString +',';
          S := S + Table1.FieldByName('所号').AsString +',';
          S := S + Table1.FieldByName('票号').AsString +',';
          S := S + Table1.FieldByName('消费金额').AsString +',';
          S := S + Table1.FieldByName('消费日期').AsString +',';
          
          WriteIn(F,S);  //<------写      Table1.Next;
        end;
      finally
        Screen.Cursor := crDefault;
        Button2.Enabled := True;
      end;
       closefile(F);end;