AnyDAC
ContentsIndexHome
PreviousUpNext
TADCustomConnection.GetLastAutoGenValue Method

Returns last auto generated value.

Group
Links
Parameters 
Description 
const AName: String 
The name of generator or sequence or empty string. 

The last auto generated value

The GetLastAutoGenValue method returns last auto-generated value. The meaning and result depends on DBMS:

DBMS 
Description 
Oracle 
AName is the name of a sequence. The method will return CurrValue, if it exists in the session. 
Interbase / Firebird 
AName is the name of a generator. The method will return GEN_ID(0). 
MS SQL Server, MySQL, etc 
The last auto generated value in the session. 
function GetLastAutoGenValue(const AName: String): Variant;
ShowMessage(VarToStr(ADConnection1.GetLastAutoGenValue('MyGen')));
What do you think about this topic? Send feedback!