testfix.pp 727 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {$mode objfpc}
  2. {$h+}
  3. program testfix;
  4. uses DB,sdfdata,sysutils;
  5. Procedure Dotest;
  6. Var
  7. I,Count : Integer;
  8. begin
  9. With TFixedFormatDataSet.Create(Nil) do
  10. try
  11. FileName := 'fpc.ssx';
  12. Schema.Add('First Name=20');
  13. Schema.Add('Last Name=20');
  14. Schema.Add('Email=30');
  15. Open;
  16. Count:=0;
  17. Try
  18. While Not EOF do
  19. begin
  20. Inc(Count);
  21. Writeln('Record : ',Count);
  22. For I:=0 to FieldCount-1 do
  23. Writeln(Fields[i].FieldName,' : ',Fields[i].AsString);
  24. Writeln('-------------------------------') ;
  25. Next;
  26. end;
  27. Finally
  28. Close;
  29. end;
  30. finally
  31. free;
  32. end;
  33. end;
  34. begin
  35. DoTest;
  36. end.