I currently have my SQL statements like this in my C# program.
SqlConnection connection = DataBase.GetConnection();
string deleteStatement = "DELETE FROM People WHERE ID = @ID";
SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection);
deleteCommand.Parameters.AddWithValue("@ID", Id);
try
{
connection.Open();
deleteCommand.ExecuteNonQuery();
}
catch (SqlException ex)
{
throw ex;
}
finally
{
connection.Close();
}
But visual studio 2019 is suggesting to use a using statement instead. Is there any benefit to using ether or?