11 Set 2014 21:22
30 Set 2016 09:10
Function GetNextInsert_id(cTabela)
Local nNextId := 0
Local oQuery, oRow
Local sql := "SELECT next_insert_id('" + HMG_LOWER(cTabela) + "') as next_id;"
oQuery := ExecutaQuery(sql)
if ExecutouQuery(@oQuery,sql)
if !oQuery:NetErr()
if ( oQuery:LastRec() > 0 )
oRow := oQuery:GetRow(1)
nNextId := oRow:FieldGet('next_id')
end
end
end
Return (nNextId)
06 Out 2016 23:39
SELECT id FROM tabela ORDER BY id DESC LIMIT 1;