In .Net, is there any functional difference between creating a new SqlCommand object and attaching a SqlConnection to it and calling CreateCo
SqlCommand
SqlConnection
CreateCo
Functionally they are exactly the same.
However, SqlConnection.CreateCommand() lets you be more agnostic about what type of DB you are using. For example instead of passing a SqlConnection instance around you could pass it around as a DbConnection which would yield a DbCommand.
SqlConnection.CreateCommand()
DbConnection
DbCommand