Quote:
the result set has no current row.
May be you should check the number of records in result.
Advice: Never calculate a next id by your code because one day or another, 2 users will create a new id at same time anf you will end up with 2 records with same id.
Let the server handle it for you.
SQL AUTO INCREMENT a Field[
^]