Scenario: You are building a database-driven application, and you need to add new records to a database table. Which ADO.NET command would you use for this task?

  • SqlCommand.ExecuteNonQuery()
  • SqlCommand.ExecuteQuery()
  • SqlCommand.ExecuteScalar()
  • SqlCommand.ExecuteXmlReader()
SqlCommand.ExecuteNonQuery() is the appropriate ADO.NET command for executing data manipulation language (DML) queries such as INSERT, UPDATE, DELETE, and MERGE. This command is used specifically for executing queries that do not return any result set, making it suitable for tasks like adding new records to a database table.
Add your answer
Loading...

Leave a comment

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