How to retrieve last primary Id from mdb's table?
Posted
by
William
on Stack Overflow
See other posts from Stack Overflow
or by William
Published on 2012-11-14T10:43:56Z
Indexed on
2012/11/14
10:59 UTC
Read the original article
Hit count: 213
I got table with next columns: Id, Name, Age, Class
I am trying to insert new row in db like this:
INSERT INTO MyTable (Name, Age, Class)
VALUES (@name, @age, @class)
And get an exeption:
"Index or primary key cannot contain a Null value."
The question is how to add a new row without knowing next primary Id, or maybe there is a way to get this Id from the table with the help of another query ?
© Stack Overflow or respective owner