Subject | Re: [firebird-support] Get the value of generated primary key after an insert |
---|---|
Author | Adriano |
Post date | 2006-05-21T08:21:52Z |
Helen (& ohers),
thank you for your help !
query = "INSERT ..... "
Set rs = cn.Execute(query, , adCmdText)
' Then i'd like to retreive the value of my IDPratica (PK and first
field of my table PRATICHE)
Dim counter as integer
query = "SELECT RDB$GET_CONTEXT ('USER_TRANSACTION', 'IDPRATICA') AS
MyVar FROM RDB$DATABASE"
Set rs = cn.Execute(query, , adCmdText)
Counter = rs!MyVar
MsgBox Counter
But i receive a Null
Why ?
Adriano
thank you for your help !
>Firebird 2 has an enhanced syntax available to return the value[s] ofI'm trying to use the new options offers by 2.x version
>one or more columns from an INSERT statement. See the release notes, pp 35-6.
query = "INSERT ..... "
Set rs = cn.Execute(query, , adCmdText)
' Then i'd like to retreive the value of my IDPratica (PK and first
field of my table PRATICHE)
Dim counter as integer
query = "SELECT RDB$GET_CONTEXT ('USER_TRANSACTION', 'IDPRATICA') AS
MyVar FROM RDB$DATABASE"
Set rs = cn.Execute(query, , adCmdText)
Counter = rs!MyVar
MsgBox Counter
But i receive a Null
Why ?
Adriano