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.
Loading...
Related Quiz
- What is the significance of the "ToList()" method in LINQ to Entities?
- Scenario: Your application needs to perform a complex join operation between multiple tables in the database. How can you achieve this using LINQ to Entities?
- The DataTextField property of a DropDownList control is used to specify the ___________ of the data items to display.
- What is deferred execution in the context of LINQ to Entities?
- Explain the concept of optimistic concurrency in LINQ to SQL.