A number of ADO.NET demonstration applications are supplied.
You can run these samples from the
Samples Browser. To start the
Samples Browser, click
Start > All Programs > Micro Focus Visual COBOL > Samples.
Note: On Windows 8, Windows 10, and Windows Server 2012, you use the Start screen to invoke programs.
To start the Samples Browser on Windows 8, Windows 10, or Windows Server 2012, go to the Start screen and click the
Samples tile.
All ADO.NET samples are listed on the
Show managed only list in the Visual COBOL Samples Browser.
The source files are located in subdirectories under
%PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\SQL\ado.net.
Each sample application comes with a
Readme file to explain how to use the application.
Before you can use any of the demonstration applications, you need to set up the data sources used by the demonstrations. You can do this with the ADO.NET Connection Editor.
The OpenESQL demonstration applications all produce a console log displaying their progress and, possibly, query results. They all terminate on receipt of an error, after displaying an error message.
- OESQL - Getting Started
- A simple example of using static SQL with OpenESQL under ADO.NET, performing a variety of SQL operations. It also demonstrates the use of different styles of CONNECT statement.
- OESQL - Connected Model
- Fills a DataSet from a data source, modifies the DataSet and then synchronizes the changes in the DataSet with the data source. The Output Window displays the modified contents of the DataSet. ConnectedDemo utilizes three methods for refreshing server generated primary keys in a DataSet. It also shows how to synchronize changes in the DataSet with the data source using either the main DataSet or a separate DataSet which only contains changed rows.
- OESQL - Cursor
- Populates a DataTable. The NoFetch program uses EXEC SQL statements to open a cursor, and then EXEC ADO statements to fetch the results. The TestCursor program performs an EXEC SQL FETCH.
- OESQL - Disconnected Model
- Manipulates offline data in a DataSet. The results of the data manipulation are displayed in the Output Window. The demonstration shows how to declare a DataSet from an XSD file generated by another project, and how to load a DataSet from an XML file generated by another application.
- OESQL - LOB Data Types
- Shows how to use ADO.NET to insert and select large objects (LOBs), shows OpenESQL working with LOB columns within a Microsoft SQL Server table, and includes instructions for working with IBM DB2 LUW.
- OESQL - Order Status
- Shows how to use ADO.NET in mixed language projects. OrderStatusDemo uses COBOL and C#. The netorderstatus program generates an XSD file from a DataSet declaration. The XSD file is then imported into the C# form. This simplifies building the user interface by enabling data binding with a strongly typed DataSet generated from the XSD file. The demonstration also shows how to use ADO.NET in legacy reuse not directly related to DBMS access. The data source used in this project is an existing COBOL subroutine.
- OESQL - OO WCF Book
- A Windows Communication Foundation (WCF) interface written in OO COBOL that interacts with an existing COBOL class. The form calls an intermediary class method in SqlBookWrapper.cbl, to funnel all requests from the WCF interface to a single routine. This encases the functionality within a run unit for isolation of resources (such as database connections) for any function triggered by the WCF interface (such as searching for a book on stock code, adding a book, deleting a book). The intermediary class then calls the business logic class' method to perform the work and access the database.
- OESQL - OO Web Application Book
- A COBOL Web Application Project which contains a Web form. The form calls an intermediary class method in SqlBookWrapper.cbl to funnel all requests from the web page to a single routine. The routine encases the functionality within a run unit for isolation of resources (such as database connections) for any function triggered by the web page (such as searching for a book on stock code, adding a book, deleting a book). The intermediary class method then calls the business logic class' method to perform the work and access the database.
- OESQL - OO WPF Book
- A Windows Presentation Foundation (WPF) interface written in OO managed COBOL that interacts with an existing OO COBOL program. The form calls methods in the DataAccess class in the OOSqlBook project to perform the business logic.
- OESQL - OO WPF Book EXEC ADO
- A Windows Presentation Foundation (WPF) interface written in OO managed COBOL that interacts with an existing OO COBOL program. The form calls methods in the DataAccess class in the OOSqlBook project to perform the business logic. DataSet and DataTable objects, along with foreign key relationships on the tables, are used with EXEC ADO statements in the form displaying book data in a tree-view structure. By default, the demo has a conditional compilation constant (UseFill) defined to use a DataSet containing DataTables in its implementation. The constant definition is set in the OOSqlBookWPF project properties/COBOL tab under Additional directives. The setting affects code in the DataSetCreator.cbl file in the OOSqlBookWPF project. Turning off this contant will make the program use stantalone DataTables filled with cursors.
- OESQL - WCF Book
- A Windows Communication Foundation (WCF) interface written in managed COBOL that interacts with an existing COBOL program. The form calls an intermediary program, SqlBookWrapper.cbl, which maps .NET data types onto COBOL data types and also funnels all requests from the WCF interface to a single routine. This encases the functionality within a run unit for isolation of resources (such as database connections) for any function triggered by the WCF interface (such as searching for a book on stock code, adding a book, deleting a book). The intermediary class then calls the business logic program (sqlbook.cbl) to perform the work and access the database.
- OESQL - Web Application Book
- A COBOL Web Application Project which contains a Web form. The form calls an intermediary program, SqlBookWrapper.cbl, which maps .NET data types onto COBOL data types and also funnels all requests from the web page interface to a single routine. This encases the functionality within a run unit for isolation of resources (such as database connections) for any function triggered by the web page interface (such as searching for a book on stock code, adding a book, deleting a book). The intermediary class then calls the business logic program (sqlbook.cbl) to perform the work and access the database.
- OESQL - WPF Book
- A Windows Presentation Foundation (WPF) interface written in managed COBOL that interacts with an existing COBOL program. The form calls an intermediary program, SqlBookWrapper.cbl, which maps .NET data types onto COBOL data types. The intermediary program then calls the existing COBOL program, sqlbook.cbl, to perform the business logic.