Recent

Author Topic: lazdbexport.TSQLExporter - no rows exported  (Read 1052 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 538
lazdbexport.TSQLExporter - no rows exported
« on: May 10, 2016, 10:33:38 pm »
Hi !
I am trying to export a dataset as insert commands with the below code but no rows are exported.
Tried to find an example in fpc\3.0.0\source\packages\fcl-db\tests with no luck.
Please help with what I am missing.

Thank you

Code: Pascal  [Select][+][-]
  1.     try
  2.       e_inserts := TSQLExporter.Create(nil);
  3.  
  4.       if e_inserts is TCustomFileExporter then
  5.       begin
  6.         e_inserts.Dataset := Source;
  7.         e_inserts.FormatSettings.TableName := 'TEST';
  8.         e_inserts.ExportFields.AddField('ID');
  9.         e_inserts.FileName := 'xxxxxxxxxx.sql';
  10.         writeln('Rows: ' + IntToStr(e_inserts.Execute));
  11.       end;
  12.  
  13.       e_inserts.Free;
  14.     except
  15.       on E: Exception do
  16.       begin
  17.         writeln('Error:' + E.Message);
  18.       end;
  19.     end;  
  20.  
Lazarus 2.0.2 64b on Debian LXDE 10

 

TinyPortal © 2005-2018