unit UCargarCurp;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Data.DB,
  Data.Win.ADODB;

type
  TFCargarCurp = class(TForm)
    Memo1: TMemo;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    DSCurps: TDataSource;
    QCurps: TADOQuery;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FCargarCurp: TFCargarCurp;

implementation

{$R *.dfm}

uses Udm;

procedure TFCargarCurp.BitBtn1Click(Sender: TObject);
var
 i: integer;
 linea, consul: string;
begin
 i:=0;
 //showmessage(inttostr(memo1.Lines.Count));
 while i <= memo1.Lines.Count do
  begin
    linea:= memo1.Lines[i];
    if linea <> '' then
    begin
      consul := 'Update Empleados set Elegido = 1 where CURP = '+ chr(39) + linea + chr(39) + ' OR Curp_2 = ' + chr(39) + linea + chr(39);
      with Qcurps do
      begin
         Qcurps.SQL.Clear;
         Qcurps.SQL.Add(consul);
         ExecSql;
      end;
    end;
    //memo2.Lines.Add('Update Empleados set Elegido = 1 where CURP = '+linea);
    inc(i);
  end;
  showmessage('listo!!');
end;

end.
