Possible Duplicate:
Difference between Parameters.Add and Parameters.AddWithValue
From MSDN code, what is the difference between these two:
SqlCommand command = new SqlCommand(commandText, connection);
//#1
command.Parameters.Add("@ID", SqlDbType.Int);
command.Parameters["@ID"].Value = customerID;
//#2
command.Parameters.AddWithValue("@demographics", demoXml);
Is it better to do the first one to make sure I am casting the parameter corrctly? I'm trying to make my code more secure.