Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   MySQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=21)
-   -   Seleccionar el ultimo registro de un campo (https://www.clubdelphi.com/foros/showthread.php?t=47344)

juangabriel1786 24-08-2007 23:08:05

Seleccionar el ultimo registro de un campo
 
Hola soy nuevo en esto, y me gustaria que me alludaran, me gustaria seleccionar el ultimo campo de un registro de una tabla y almacenarla en una variable, please ayudenme...

Caral 24-08-2007 23:23:37

Hola
Código Delphi [-]
var
 x: String;
begin
MyQuery.sql.text:= 'Sellect last (TuTable.TuCampo) as TuNombre From TuTabla';
 x:= MyQuery.Fields[0].AsString;
end;
saludos

sexshop_3 25-08-2007 04:35:32

SI ESTAS USANDO UN Ttable:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var nombre:string
begin
    table.last;
    nombre:=table.fieldbyname('clave').asstring;
end;

DONDE 'clave' ES EL NOMBRE DEL CAMPO DEL QUE QUIERES SACAR LOS DATOS


La franja horaria es GMT +2. Ahora son las 19:27:50.

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