Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Moverse por los registros en SQL Server (https://www.clubdelphi.com/foros/showthread.php?t=80719)

dec 01-07-2006 02:37:03

Moverse por los registros en SQL Server
 
Moverse por los registros con Microsoft SQL Server

Código Delphi [-]
procedure tbPrincipioClick(sender: TObject);
begin
  with quClientes do begin
    close;
    SQL.clear;
    SQL.add( 'SET ROWCOUNT 1' );
    SQL.add( 'SELECT Codigo, Nombre FROM Clientes ORDER BY Codigo' );
    open;
  end;
end;

// Para final de fichero la instruccion seria:
Código SQL [-]
SET ROWCOUNT 1

SELECT Codigo, Nombre FROM Clientes ORDER BY Codigo DESC

//Para proximo registro
SET ROWCOUNT 1

SELECT Codigo, Nombre FROM Cliente WHERE Codigo > :parametro ORDER BY Codigo

// Para registro anterior

SET ROWCOUNT 1

SELECT Codigo, Nombre FROM Cliente WHERE Codigo < :parametro ORDER BY Codigo DESC


La franja horaria es GMT +2. Ahora son las 13:05:36.

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