1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| unit UnitfdlocalSQL;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
FireDAC.DApt.Intf, Data.DB, FireDAC.UI.Intf, FireDAC.Stan.Def,
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite,
FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs, FireDAC.VCLUI.Wait,
Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids, FireDAC.Comp.Client,
FireDAC.Phys.SQLiteVDataSet, FireDAC.Comp.DataSet, FireDAC.DApt;
type
TForm47 = class(TForm)
TempTable: TFDMemTable;
FDLocalSQL1: TFDLocalSQL;
FDConnection1: TFDConnection;
TempTableFDMemTable1Id: TIntegerField;
TempTableFDMemTable1Nom: TStringField;
TempTableFDMemTable1Date: TDateField;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
btnInsert: TButton;
FDQuery1: TFDQuery;
btnUpdate: TButton;
procedure btnInsertClick(Sender: TObject);
procedure btnUpdateClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form47: TForm47;
implementation
{$R *.dfm}
procedure TForm47.btnInsertClick(Sender: TObject); // remplissage
var
I: Integer;
begin
for I := 1 to 10 do
FDQuery1.ExecSQL('INSERT INTO temptable(fdmemtable1ID,fdmemtable1NOM) VALUES (:i,:a)',[i,'Aaaa']);
end;
procedure TForm47.btnUpdateClick(Sender: TObject); // mise àjour des 5 premiers
var i : integer;
begin
for I := 1 to 5 do
FDQuery1.ExecSQL('UPDATE temptable SET fdmemtable1NOM=:n, '+
'fdmemtable1date=:d where fdmemtable1ID=:i',['BB',date,i]);
end;
end. |
Partager