Created an application using Visual COBOL R3 that used the EXEC ADO GET CURSOR statement to retrieve a dataset object from a SQL SELECT CURSOR in order to bind the object to a DataGridView Control.
This worked fine in Visual COBOL R3.
When runnimng the same application in Visual COBOL 2.0 an error now occurs on the EXEC SQL GET CURSOR statement.
The sqlcode is 19501 and the error is "Invalid Cursor State"
The following demo was used.
The demo uses 32-bit ADO connection mapped to the Northwind database.
It has a form with a datagridView control on it which is bound to a table within an ADO.NET dataset object.
The dataset object is returned using:
DECLARE drcursor scroll CURSOR FOR SELECT
FROM Customers A
exec ado get cursor drcursor into :lsCursorObj
rename datatable as "Customers"
This used to work under R3 but now it the dataset is not being populated with any tables.
When this is executed under VC 2.0 and the RENAME phrase is used it fails with 19501 invalid cursor state.
If the RENAME DATATABLE clause is removed then it executes OK but there is no table in the dataset so the binding fails.
What is the problem?
Applications migrating from earlier versions of Visual COBOL or from other products that support ADO.NET that use Microsoft SQL Server and depend on cursors that are not explicitly declared as forward only, read only being implemented as ADO.NET datasets must use the directive SQL(BEHAVIOR=UNOPTIMIZED) or update their code to declare cursors using the scrolloption 'dataset' that require a dataset-based cursor. This is because in Visual COBOL and Enterprise Developer 2.0 and later, the default setting of SQL(BEHAVIOR) is MAINFRAME.