Scenario: You are developing an application that needs to execute a complex SQL query with parameters. Which ADO.NET object would you use for this task?
- SqlCommand
- SqlConnection
- SqlDataAdapter
- SqlDataReader
SqlCommand is used to execute SQL commands, including complex queries, with parameters. It allows for parameterized queries, reducing the risk of SQL injection attacks and enhancing performance by reusing execution plans.
Loading...
Related Quiz
- In ADO.NET, what are the two key functions of a DataAdapter?
- Which part of Entity Framework is responsible for translating LINQ queries into SQL queries?
- The AcceptChanges method is typically called after ___________.
- Parameters in non-query commands help prevent ___________ attacks.
- The Repeater control relies heavily on ________ binding to display data.