Connected Database Scenario

In the previous section, we described establishing and terminating a connection to the database. This section describes what action we may take while we have an open connection to the database. In other words, we show how to work in the connected database scenario.

Command Class

When writing database-oriented applications, we run different commands against our data source. We issue our statements with the help of the SqlCommand class. The command class performs the following actions:

  • Executes SQL statements

  • Executes DDL (Data Definition Language) statements

  • Runs stored procedures

We initialize the command object with the command text and connection object. Here is how we create a new command that will query the People ...

Get Programming PERL in the .NET Environment 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.