CopyPastor

Detecting plagiarism made easy.

Score: 1.7546568512916565; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2016-09-29
by Rick Wolff

Original Post

Original - Posted on 2013-02-11
by Shafeeq Koorimannil



            
Present in both answers; Present only in the new answer; Present only in the old answer;

In this answer: https://stackoverflow.com/a/14816172/4519548
The guy adds the parameter a bit differently. He passes the SqlDbType.Int to the Add method:
SqlParameter returnParameter = cmd.Parameters.Add("RetVal", SqlDbType.Int); returnParameter.Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); int id = (int) returnParameter.Value;
Maybe this helps you.
You need a parameter with Direction set to `ParameterDirection.ReturnValue` in code but no need to add an extra parameter in SP. Try this

SqlParameter returnParameter = cmd.Parameters.Add("RetVal", SqlDbType.Int); returnParameter.Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); int id = (int) returnParameter.Value;



        
Present in both answers; Present only in the new answer; Present only in the old answer;