12.4. Commands

Commands – implemented as OleDbCommand and SqlCommand classes – are the only way to execute SQL statements and stored procedures in ADO.NET. Both managed providers implement the IDbCommand interface and inherit the following properties.

  • CommandText This property (of a String type) specifies the SQL statement, name of the stored procedure or table (for the OLE DB managed provider only) to be executed against the data store. The meaning of the contents of this property depends on the value set for the CommandType property.

  • CommandTimeout This property (of an Integer type) specifies the number of seconds to wait before terminating the attempt to execute a command and generating an error. The default value is 30 seconds.

  • CommandType ...

Get A Programmer's Guide to .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.