Export (0) Print
Expand All

Implementing a Command

.NET Framework 1.1

The Command object is responsible for formulating a request and passing it on to the data source. If results are returned, the Command object is responsible for returning results as a DataReader, a scalar value, or as parameters.

To implement a Command object, create a class that implements IDbCommand. Implement the ExecuteReader method to return a resultset (or multiple resultsets) as a DataReader, the ExecuteScalar method to return a result as a scalar value, and the ExecuteNonQuery method to process a command at the data source that does not return a resultset but may return parameters.

The following topics contain sample code for an implementation of a Command object.

For a sample Visual Basic implementation:

For a sample C# implementation:

See Also

Implementing a .NET Framework Data Provider | Sample .NET Framework Data Provider

Show:
© 2014 Microsoft