i need to update (Id+1) from an sql table and in same query to select that id.
i'm using code below but i'm afraid that if more than one client pc's run the same query then i will have conflict and i will take wrong id
SqlCommand cmd2 = new SqlCommand("update TrnDocuments set TrnNumber+=1 ;select (TrnNumber)as TrnNum from TrnDocuments ", con);
SqlDataReader read2 = cmd2.ExecuteReader();