You need to execute a stored procedure in ADO.NET that inserts data into a database table. Which ADO.NET object would you use for this task, and how would you pass the necessary parameters?
- SqlCommand
- SqlDataAdapter
- SqlConnection
- SqlDataReader
SqlCommand is the correct option. It represents a Transact-SQL statement or stored procedure to execute against a SQL Server database. Parameters can be passed using the SqlCommand.Parameters collection. SqlDataReader is used for reading a forward-only stream of rows. SqlConnection represents a connection to a SQL Server database. SqlDataAdapter is used to fill a DataSet and update a SQL Server database.
Loading...
Related Quiz
- How does ADO.NET handle resource management for connections that are not explicitly closed by the application?
- What is distributed transaction management in ADO.NET, and when might it be necessary?
- In data binding, what is the role of the data source?
- What is the difference between optimistic concurrency and pessimistic concurrency in ADO.NET?
- The ObjectContext class is responsible for ___________ with the underlying database.