123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- (******************************************************************************
- * *
- * (c) 2005 CNOC v.o.f. *
- * *
- * File: eFillTableParams.pp *
- * Author: Joost van der Sluis ([email protected]) *
- * Description: SQLDB example and test program *
- * License: GPL *
- * *
- ******************************************************************************)
- program eFillTableParams;
- {$mode objfpc}{$H+}
- uses
- Classes, sysutils,
- sqldb,
- SqldbExampleUnit;
-
- var i : integer;
- begin
- ReadIniFile;
- CreateFConnection;
- CreateFTransaction;
- CreateFQuery;
- with Fquery do
- begin
- SQL.Clear;
-
- SQL.Add('insert into FPDEV ( id, Name, Email, BirthDate) ');
- SQL.Add(' values ( :id, :name, :email, :birthdate ) ');
- for i := 2 to 4 do
- begin
- params.ParamByName('id').asinteger := i;
- params.ParamByName('name').asstring := FPdevNames[i];
- params.ParamByName('email').AsString := FPdevEmails[i];
- params.ParamByName('birthdate').AsDateTime := FPdevBirthDates[i];
- ExecSql;
- end;
- for i := 5 to 7 do
- begin
- sql[1] := 'values ('+inttostr(i)+ ', ' +
- '''' +FPdevNames[i]+ ''', ' +
- '''' +FPdevEmails[i]+ ''', ' +
- '''' +FormatDateTime('MM-DD-YYYY',FPdevBirthDates[i])+ ''')';
- ExecSql;
- end;
- end;
- Ftransaction.CommitRetaining;
- Fquery.Free;
- Ftransaction.Free;
- Fconnection.Free;
- end.
|