how to get autoid
-
hi friend, i've a query, pls help me. suppose, i've a table which has am autoid field. now i am inserting a row in that table. how i can get the autoid of the new inserted row? is there any process to get back the autoid when use ExecuteNonQuery( ) method or else? i don't want to use max(autoid) on the that table, because it can result on concurrency problem. With Regards, samrat
-
hi friend, i've a query, pls help me. suppose, i've a table which has am autoid field. now i am inserting a row in that table. how i can get the autoid of the new inserted row? is there any process to get back the autoid when use ExecuteNonQuery( ) method or else? i don't want to use max(autoid) on the that table, because it can result on concurrency problem. With Regards, samrat
-
hi friend, i've a query, pls help me. suppose, i've a table which has am autoid field. now i am inserting a row in that table. how i can get the autoid of the new inserted row? is there any process to get back the autoid when use ExecuteNonQuery( ) method or else? i don't want to use max(autoid) on the that table, because it can result on concurrency problem. With Regards, samrat
samrat.net wrote:
is there any process to get back the autoid when use ExecuteNonQuery( )
ExecuteNonQuery() returns the number of rows affected and nothing else.
samrat.net wrote:
i don't want to use max(autoid) on the that table, because it can result on concurrency problem.
you can use
SELECT @@IDENTITY as Value
.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.