-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Pri2Indicates issues/PRs that are medium priorityIndicates issues/PRs that are medium priorityarea-System.Data.SqlClientdotnet-api/produntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
I noticed that SqlCommand implements IDisposable (or rather DbCommand does and SqlCommand inherits from DbCommand), but in some instances in the docs I've seen SqlCommand is not wrapped in a using statement. Is there a reason for this? Maybe we are trusting SqlConnection to garbage collect the resources of SqlCommand?
Is it not a problem if SqlCommand isn't wrapped in a using? It seems I always see SqlConnection wrapped in a using; however, so I assume that's quite important.
Thanks.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: ee7dd835-d5dd-19e6-b044-1ed38f45289c
- Version Independent ID: 890a868d-fef0-0580-97b5-f29eb73df6c2
- Content: SqlCommand Class (System.Data.SqlClient)
- Content Source: xml/System.Data.SqlClient/SqlCommand.xml
- Product: dotnet-api
- GitHub Login: @douglaslMS
- Microsoft Alias: douglasl
Metadata
Metadata
Assignees
Labels
Pri2Indicates issues/PRs that are medium priorityIndicates issues/PRs that are medium priorityarea-System.Data.SqlClientdotnet-api/produntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner