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?
SqlCommand
SqlConnection
CreateCommand()
No, they are the same thing.
I disassembled SqlConnection.CreateCommand and found this:
SqlConnection.CreateCommand
public SqlCommand CreateCommand() { return new SqlCommand(null, this); }
which proves that they really are the same thing.
1.4m articles
1.4m replys
5 comments
57.0k users