8

I have always included the at sign in the parameter name when using AddWithValue, but I just noticed some code written by someone else that doesn't use it. Is one way more correct than the other?

cmd.Parameters.AddWithValue("ixCustomer", ixCustomer);

or

cmd.Parameters.AddWithValue("@ixCustomer", ixCustomer);

1 Answer 1

7

No, both are equivalent in the end. I personally tend to use the notation with the @ sign myself, to be consistent with the T-SQL code for stored proc I write.

But as far as I know, both methods are fine for .NET apps interfacing with SQL Server.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.