Scenario: You want to implement data retention policies in your application by deleting old records from a database table. Which ADO.NET command would you use to perform this task?

  • SqlCommand.ExecuteNonQuery()
  • SqlCommand.ExecuteQuery()
  • SqlCommand.ExecuteScalar()
  • SqlCommand.ExecuteXmlReader()
SqlCommand.ExecuteNonQuery() is commonly used to execute non-query commands, including data manipulation language (DML) queries like DELETE statements. This command is suitable for tasks that modify the database without returning any data, making it ideal for deleting old records from a database table as part of a data retention policy.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *