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.
Loading...
Related Quiz
- Which ADO.NET object is responsible for managing transactions?
- Using a database-specific data provider, such as SqlClient, can result in ___________ performance compared to generic providers.
- What does EF stand for in the context of ADO.NET Entity Framework?
- Which LINQ operator is used for filtering data in LINQ to Entities queries?
- DataRelations are used to define ___________ between DataTables in a dataset.