Hi, I'm facing this thing I don't know what to call it -a bug or whatsoever- I have this code which is self explanatory! I am receiving rows form the database using the EXEC ADO statements in order to bind the dataset to a GridView using WebForms so whenever I call this program I will get the same result of the queries -inside the cursor- which in all-customers section but, when I change the cursor name I get the appropriate result of each. I know that OpenESQL is a pre-compiler but even though it behavior is to compile SQL before compiling the code, and the generate the appropriate native code why doesn't it override my cursor a.k.a custoemrscursor since I will only access one section of the code each time the program is called due to the nature of the EVALUATE statement?
Here is the code:
program-id. CustomersReportsas"BusinessLogicModel.BusinessLogic.CustomersReports".
datadivision.
working-storagesection.
01 customers-dataset type System.Data.DataSet.
execsqlincludesqlcaend-exec.
linkagesection.
01 report-name is string.
01 report-term is string.
01 result-set type System.Data.DataSet.
proceduredivisionusingreport-name, report-termreturningresult-set.
copy'DatabaseConnection'.
evaluatereport-name
when'all-customers'
performall-customers
when'customers-by-country'
performcustomers-by-country
end-evaluate.
goback.
all-customers.
execsqldeclarecustomerscursordatasetcursorfor
selectcustomer_id, customer_name, country
fromcustomer
end-exec.
execsql
opencustomerscursor
end-exec.
execadogetcursorcustomerscursorinto :customers-dataset
renamedatatableasallcustomers
end-exec.
setresult-settocustomers-dataset::Copy.
execsql
closecustomerscursor
end-exec.
execsql
disconnectcurrent
end-exec.
customers-by-country.
execsqldeclarecustomersbycountrydatasetcursorfor
select *
fromcustomer
wherecountry = :report-term
end-exec.
execsql
opencustomersbycountry
end-exec.
execadogetcursorcustomersbycountryinto :customers-dataset
renamedatatableascustomersbycountry
end-exec.
setresult-settocustomers-dataset::Copy.
execsql
closecustomersbycountry
end-exec.
execsql
disconnectcurrent
end-exec.
endprogramCustomersReports.