diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs index 2ff95f2e3b..65541d5e3a 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -1346,7 +1346,7 @@ internal void DeriveParameters() useManagedDataType = false; } - SqlCommand paramsCmd = new SqlCommand(cmdText.ToString(), Connection, Transaction) + using SqlCommand paramsCmd = new SqlCommand(cmdText.ToString(), Connection, Transaction) { CommandType = CommandType.StoredProcedure };