Tutorial: Object-Oriented Web Application using SQL

Walks you through the creation of an object-oriented Windows ASP.NET Web application that interacts with the BookDemo base application using SQL.

The project you create in this tutorial includes a page that is generated in .NET COBOL. The page calls an intermediary class method to funnel all requests from the Web page to a single routine. This encases the functionality within a run unit for isolation of resources, such as database connections, for any function triggered from the Web page. The intermediary class method then calls the business logic class method to perform the work and access the database.

Prerequisites

  • Review the Assumptions and Before you begin sections in the Tutorials: OpenESQL .NET Code topic to ensure that your environment is set up properly.
  • Before attempting this tutorial, you must first work through Tutorial: Prepare the SQL Server Environment.
  • The features demonstrated in this tutorial require that you have installed the Enterprise Developer ASP.NET and Web Applications feature. If this feature is missing, see To install missing features from the IDE for installation instructions.

Demonstration solution - OOSQLBookDemoWebApplication

The OOSQLBookDemoWebApplication solution and project you create for this tutorial uses the following provided demonstration files in addition to the BookDemo base application:

sqlbook.cbl
In this tutorial, sqlbook.cbl is recompiled as a COBOL class that contains the business logic and database access code. This class is supplied and this tutorial adds it as a project reference to the Web application project.
SqlBookWrapper.cbl
In this tutorial, SqlBookWrapper program is recompiled as an intermediary class. This intermediary class is added as a project reference to the Web application project. The class creates a run unit, and passes the function code, along with the book details, to the business logic class defined in sqlbook.cbl to perform the work involving SQL.
Default.aspx
The main Web form. You modify it to contain user input fields, output display fields, and a trigger button used to call the client program. Input and output fields are defined as text boxes.
Default.aspx.cbl
This is the generated client COBOL program that is triggered by an end user click event initiated from the main Web form. When triggered, it:
  • Extracts the input data from text boxes on the form as System.Strings.
  • Calls the SqlBookWrapper program, passing it the string objects and receiving output as System.Strings.
  • Populates the text boxes on the form with the received System.Strings.
Web.config
The application configuration file.
Note: The solution used in this tutorial is also provided with the Visual COBOL Samples Browser in completed form. To review the completed solution:
  1. Start the Visual COBOL Samples Browser. If you need instructions, see To start the Samples Browser.
  2. From the drop-down menu at the top of the Visual COBOL Samples Browser, select Show .NET only.
  3. In the left pane, click SQL.
  4. In the right pane, click OESQL - OO Web Application Book (.NET, VS).

Sequence

To complete this tutorial, progress through these topics in the order presented here. The bottom of each topic provides Next topic and Previous topic navigational links to help you proceed in the proper sequence: