cfilltable.pp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. (******************************************************************************
  2. * *
  3. * (c) 2005 CNOC v.o.f. *
  4. * *
  5. * File: cFillTable.pp *
  6. * Author: Joost van der Sluis ([email protected]) *
  7. * Description: SQLDB example and test program *
  8. * License: GPL *
  9. * *
  10. ******************************************************************************)
  11. program CFillTable;
  12. {$mode objfpc}{$H+}
  13. uses
  14. Classes,
  15. sqldb,
  16. SqldbExampleUnit;
  17. begin
  18. ReadIniFile;
  19. CreateFConnection;
  20. CreateFTransaction;
  21. // create FQuery
  22. Fquery := TSQLQuery.create(nil);
  23. with Fquery do
  24. begin
  25. database := Fconnection;
  26. transaction := Ftransaction;
  27. end;
  28. with Fquery do
  29. begin
  30. SQL.Clear;
  31. SQL.Add('insert into FPDEV ( ');
  32. SQL.Add(' id, ');
  33. SQL.Add(' Name, ');
  34. SQL.Add(' Email, ');
  35. SQL.Add(' Birthdate) ');
  36. SQL.Add('values ( ');
  37. SQL.Add(' 1, ');
  38. SQL.Add(' ''Florian Klaempfl'', ');
  39. SQL.Add(' ''[email protected]'',');
  40. SQL.Add(' ''1-1-1975'' ');
  41. SQL.Add('); ');
  42. ExecSql;
  43. end;
  44. Ftransaction.CommitRetaining;
  45. Fquery.Free;
  46. Ftransaction.Free;
  47. Fconnection.Free;
  48. end.