Must declare scalar value

Problem:

You have made a change to an insert method of an ASP.NET dataset, by adding one or more input parameters, and you've noticed that it has not updated the actual method in the generated code. When running the insert method you get the following error: "Must declare scalar value ..."

Solution:

One thing causing this could be that you have added "SELECT SCOPE_IDENTITY()" to the end of the SQL in the data set method. This will prevent the data set code generator from updating the method in the generated code even though it tells you the method has been updated.  Remove "SELECT SCOPE_IDENTITY()" from the SQL and add the variable. Update the dataset, compile the code and put the "SELECT SCOPE_IDENTITY()" back in. Remember to change the ExecuteMode property of the method back to Scalar!

Your problem is now solved.

Happy programming! :-)