Which method is used to execute a non-query command and retrieve the number of rows affected?
- ExecuteNonQuery()
- ExecuteReader()
- ExecuteScalar()
- ExecuteXmlReader()
The ExecuteNonQuery() method is used to execute a non-query SQL statement against a database. It returns the number of rows affected by the command. This method is commonly used with INSERT, UPDATE, DELETE, and other SQL commands that do not return data. By utilizing ExecuteNonQuery(), developers can perform data manipulation operations and obtain feedback on the success or failure of their commands by examining the number of rows affected, facilitating efficient database interaction in ADO.NET.
Loading...
Related Quiz
- The let keyword in LINQ is used to define ___________ that can be reused within the query.
- Which ADO.NET control is commonly used for data binding in Windows Forms applications?
- Parameterized queries help prevent _______ attacks by sanitizing user input.
- What is the purpose of RowFilter property in a DataView?
- You have a complex inheritance hierarchy in your entity model. How can Entity Framework help you map these entities to the appropriate database tables?