November 7, 2012
SqlCommand.Parameters.Add() vs SqlCommand.CreateParameter()
When doing some quick research on SQL Parameters with SqlCommand, I noticed two methods which seemed to perform the same task, SqlCommand.Parameters.Add() and SqlCommand.CreateParameter(). After looking into each method on MSDN, I noticed that CreateParameter() will simply create the parameter, while Parameters.Add() will create the parameter and add it to the parameter collection. SqlCommand.Parameters.Add() The following example will create a SQL command object, create...