Ver Mensaje Individual
  #17  
Antiguo 26-07-2024
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 937
Reputación: 24
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Estimado Colega, si está utilizando un TMemo, le sugiero el siguiente cambio...

Código Delphi [-]
procedure tform1.Button1Click (sender:tobjet);

var
      anios1,anios2,anios3:string;
      x,c:Integer;

begin
       c:=1
       {for x:=1 to Memo1.Lines.Count - 1 do
            begin
              anios1:=Memo1.Lines[x];
              anios2:=anios2+anios1+ ',';
              anios3:=anios2+'0';
       end;
       }
       Memo1.Lines.Delimiter:=',';
       anios3:=Memo1.Lines.DelimitedText;

       with tqueryMotivos do
       close;
       sql.clear;
       sql.add('select anio,Motivo from Motivos where Motivo in '(' + anios3 + ')';
       open;

       while not IbQueryMotivo.eof do
                begin
                   Stringgrid1.cells[c]:=IbQueryMotivo.FieldByname(anio).AsString;
                   StringGrid1.Cells[c]:=IbQueryMotivo.FieldByname(Motivo).AsString;
                   inc(c);
                   IbQueryMotivo.next;
                 end;

Saludos cordiales
Responder Con Cita