Is There Any Difference Between SqlConnection.CreateCommand and new SqlCommand?
ado.net, c#
Solution
No, they are the same thing.
I disassembled `SqlConnection.CreateCommand` and found this:
public SqlCommand CreateCommand()
{
return new SqlCommand(null, this);
}
which proves that they really are the same thing.
Problem
In .Net, is there any functional difference between creating a new `SqlCommand` object and attaching a `SqlConnection` to it and calling `CreateCommand()` on an existing `SqlConnection` object?