A number of ADO.NET demonstration applications are supplied in the Samples Browser, available from Start > All Programs > Micro Focus Enterprise Developer > Samples > Visual COBOL Samples. These files are located in the %PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples\sql\ado.net .
Each sample application comes with a Readme file to explain how to use the application, and a makefile.
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.
Connected Demo uses the SQL Server Northwind database. You must set up a connection to the Northwind database to run the Connected Demo project.
The ConnectedDemo.cbl program fills a DataSet from a data source, modifies the DataSet and then synchronizes the changes in the DataSet with the data source. The modified contents of the DataSet are displayed in the Output Window.
Connected Demo demonstrates three methods for refreshing server generated primary keys in a DataSet after rows are added; a statement batch, a separate TO REFRESH statement and a stored procedure with output parameters. Connected Demo also shows you how to synchronize changes in the DataSet with the data source using either the main DataSet or a separate DataSet which contains only changed rows. You could use the latter method to minimize network traffic in a distributed application.
You must set up a connection to the SQL Server Northwind database to run the Cursor Demo project. This project demonstrates how to intermix OpenESQL with direct calls to ADO.NET.
The NoFetch.cbl program uses EXEC SQL to open a cursor and then EXEC ADO to fetch the results. The TestCursor.cbl program performs an EXEC SQL FETCH. The CursorDemo.cbl program populates a DataTable.
The DisconnectedDemo.cbl program manipulates offline data in a DataSet. The results of the data manipulation are displayed in the Output Window.
Disconnected Demo demonstrates 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.
This project shows how ADO.NET can be used in mixed language projects to insert and select large objects (LOBs). LobDemo shows OpenESQL working with LOB columns in a SQL Server table.
LOB columns are columns that can be up to 2GB in size. In this demo, the LOB columns are image columns and the OpenESQL object reference host variable.
The LobDemo.cbl program includes instructions for changing Lob Demo to use DB2 LUW and BLOB columns.
The Order Status Demo project shows how ADO.NET can be used in mixed language projects. Order Status Demo uses COBOL and C#.
The netorderstatus.cbl 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.
Order Status Demo also demonstrates the use of ADO.NET in legacy reuse not directly related to DBMS access. The data source used in this project is an existing COBOL subroutine.
The techniques used in this demo are applicable to CICS ECI transactions.