![]() |
AW: Sql-Befehl anpassen
I hoabs jet :D
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; |
AW: Sql-Befehl anpassen
Zitat:
Delphi-Quellcode:
So sparst du noch die Variable lMax und eine entsprechende Zuweisung ;-)
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; |
AW: Sql-Befehl anpassen
Hatte ich das nicht bereits in
![]() |
AW: Sql-Befehl anpassen
Zitat:
|
AW: Sql-Befehl anpassen
Warum ein Clear und dann ein Add (wenn dann sowieso Append!)?
Setze doch einfach den Text...
Delphi-Quellcode:
function TFormMain.MaxUnivID(tb: string): Integer;
begin qu.Close; qu.SQL.Text:=Format('SELECT MAX(ID) MaxID FROM %s', [tb]); qu.Open; Result:= qu.FieldByName('MaxID').AsInteger; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:07 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz