Is There Any Difference Between SqlConnection.CreateCommand and new SqlCommand?

前端 未结 4 1543
灰色年华
灰色年华 2020-12-08 14:22

In .Net, is there any functional difference between creating a new SqlCommand object and attaching a SqlConnection to it and calling CreateCo

4条回答
  •  独厮守ぢ
    2020-12-08 14:52

    They do the same thing. The rationale behind SqlConnection.CreateCommand is to implement the factory pattern.

提交回复
热议问题