OpenESQL Assistant with ADO.NET


Could anybody please help me in automating this task using the OpenESQL Assistant for ADO.NET mode, since I have to rewrite the same code every time with slight changes such a cursor name and the query of course


    exec sql declare all_accounts_cursor dataset cursor for


        select * from account






    exec sql


        open all_accounts_cursor






    exec ado get cursor all_accounts_cursor into :accounts-dataset


        rename datatable as account_table






    set result-set to accounts-dataset::Copy.




    exec sql


        close all_accounts_cursor




  • Verified Answer

    Hi Ahmet,

    The OpenESQL Assistant can be used for automating the code generation for some of the commonly used tasks but it does not support every possible code scenario.

    The scenario that you present here, where you are using a mixture of EXEC SQL and EXEC ADO statements is one of those scenarios that are not supported.

    You can generate the EXEC SQL cursor through the OpenESQL Assistant but then your would manuallly have to add the code to get the cursor into a dataset.

    An alternative to using the EXEC SQL would be to generate the statements as EXEC ADO connected model statements entirely which also allows you to read the rows from a database connection and then create a dataset from it. although I also find it easier to use the combination of EXEC SQL and EXEC ADO GET CURSOR INTO statements.