PdcDBQuery.LastAutoIncValue

From External Bemet Wiki
Jump to navigation Jump to search

Declaration

LastAutoIncValue as integer

Description

Returns the last value of the autoincrement field that is created by the query

Notes

This method Returns the last value of the autoincrement field that is created by the query.

Code example

This code example executes a SQL statement and returns the LastAutoIncValue .

Sub sExecuteQuery
dim objQuery
dim intCnt

  set objQuery = pdc.Database.OpenQuery(pdcConData)
  for intCnt = 0 tot 12
    objQuery.SQL = "INSERT INTO USERTABLE (USER1) VALUES ('TestField')"
    if objQuery.Execute then
      msgbox objQuery.LastAutoIncValue
    else
      msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & objQuery.SQL
    end if
  next
  
End Sub

Availability

Available since September 2017(from version 5.3)