Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Conexión con bases de datos (https://www.clubdelphi.com/foros/forumdisplay.php?f=2)
-   -   Consecutivo con While (https://www.clubdelphi.com/foros/showthread.php?t=50926)

Camilo 02-12-2007 16:23:03

Consecutivo con While
 
Hola Amigos Siempre es un placer repasar sus conocimientos y aportes.

Espero su ayuda de ser posible claro esta en el siguiente tema:

Tengo una tabla con un campo llamado Consignacion_No el cual necesito rellenar mensualmente con un numero consecutivo.
trabajo con Paradox y D-7. El tema es que lo hago d la siguiente manera y no interrumpo el ciclo. En todo caso no se si funciona; alguna ayudita por favor.
Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
var
Consecutivo: Integer;
begin
Consecutivo := 0;
Consecutivo := Consecutivo + table1['Consignacion_No'];
table1.First;
try
table1.DisableControls;
while not table1.EOF do
begin
if table1['Consignacion_No'] = '0' then
begin
table1.Edit;
table1.Fieldbyname('Consignacion_No').AsString := 'Consecutivo';
table1.Next;
end;
end;
finally
table1.EnableControls;
end;
end;

Por su ayuda mil y mil gracias.

marcoszorrilla 02-12-2007 21:13:27

Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
var
Consecutivo: Integer;
begin
Consecutivo := 0;
Consecutivo := Consecutivo + table1['Consignacion_No'];
table1.First;
try
table1.DisableControls;
while not table1.EOF do
begin
if table1['Consignacion_No'] = '0' then
begin
table1.Edit;
table1.Fieldbyname('Consignacion_No').AsString := 'Consecutivo';
end;
table1.Next;
end;
finally
table1.EnableControls;
end;
end;
Un Saludo.

Camilo 02-12-2007 22:44:08

Marcos Muchisimas gracias, funciona muy bien. No te habia podido dar las gracias antes por que habia salido a almorzar y hasta ahora regreso al trabajo.

En todo caso todo bien y nueva mente mil gracias.


La franja horaria es GMT +2. Ahora son las 10:35:15.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi