'First I execute a command object to insert a new record
objCmd.ExecuteScalar()
'Immediately after, I reset the command object's text
'property to the value below, set its command type (I'm
'using stored queries in Access, hence specifying
'commandtype.text...you may not have to do that line)
'and execute the command. This will return the new
'autonumber.
objCmd.CommandText = "Select @@Identity"
objCmd.CommandType = CommandType.Text
Return objCmd.ExecuteScaler()
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.