Don't do that.
Instead make your ID field an IDENTITY field and SQL will handle it for you.
The problem with your method is that it will fail in production: as soon as two users try to insert new rows at the same time, they will fail because your TempID can't be duplicated! Or if it can, that makes it even worse because all the rows with that value will be changed...
SQL AUTO INCREMENT a Field[
^]