Registriert seit: 5. Aug 2002
Ort: Hannover
82 Beiträge
Delphi XE Starter
|
AW: Sql-Befehl anpassen
6. Mai 2011, 12:30
I hoabs jet
Delphi-Quellcode:
function TFormMain.MaxUnivID(tb: string): Integer;
var
lMax : Integer ;
begin
qu.Close ;
qu.SQL.Clear ;
qu.SQL.Add( Format( 'Select max(ID) as MaxID from %s', [ tb ] ) ) ;
qu.Open ;
lMax := qu.FieldByName('MaxID').AsInteger;
Result := lMax ;
end;
Delphi-Quellcode:
function TFormMain.MaxUnivID(tb: string): Integer;
begin
qu.Close ;
qu.SQL.Clear ;
qu.SQL.Add( Format( 'Select max(ID) as MaxID from %s', [ tb ] ) ) ;
qu.Open ;
Result := qu.FieldByName('MaxID').AsInteger;
end;
So sparst du noch die Variable lMax und eine entsprechende Zuweisung
|