[ADODB] letzte Insert ID ermitteln

With DBRecordset
     .ActiveConnection = DBConnection
     .CursorLocation = ADODB.CursorLocationEnum.adUseClient
     .LockType = ADODB.LockTypeEnum.adLockOptimistic
     .Open("SELECT @@IDENTITY")
     
     oder
     
     .Open("SELECT MAX(ID_Field) FROM Table")
     
     If .RecordCount = 1 Then
         Dim iZahl As Interger = .Fields(0).Value
     End If
End With

Schreibe einen Kommentar