|
Here, we’re going to look at the most often used or needed methods of the command object (OleDbCommand or SQLCommand), their differences and how each one is used. They are the ExecuteReader, ExecuteNonQuery, and ExecuteScalar methods. Once you make a connection to your database and create a command, you’re going to need one of these methods to execute the command.
This is known as a forward-only retrieval of records – it uses your sql statement to read through the table from the first to the last.
Here, also, we have many code samples using ExecuteNonQuery.
This would be excellent for receiving a count of records (Select Count(*)) in an sql statement, or for any query where only one specific field in one column is needed.
|