Home > database >  The cursor in the SQL access problem, very strange, I novice, predecessors to guide, please.
The cursor in the SQL access problem, very strange, I novice, predecessors to guide, please.

Time:09-16

Long ll_id, ll_row
Declare c1 cursor for the select id from jc_zz where js='1';
The open c1;
The fetch c1 into: ll_id;
The do while the sqlca. Sqlcode=0
Select count (*) into: ll_row from jc_gnzd; Article 88 in the table//jc_gnzd data
Messagebox (' tip 'll_row)
The fetch c1 into: ll_id;
Loop

The cursor (if there are five loops) the SQL access, ll_row variables can only take to 88, in the last four front is 0, do not know why

CodePudding user response:

Suggest using datastore or datawindow to replace cursor, not easy to get wrong

CodePudding user response:

The
refer to the original poster nj_yys response:
long ll_id, ll_row
Declare c1 cursor for the select id from jc_zz where js='1';
The open c1;
The fetch c1 into: ll_id;
The do while the sqlca. Sqlcode=0
Select count (*) into: ll_row from jc_gnzd; Article 88 in the table//jc_gnzd data
Messagebox (' tip 'll_row)
The fetch c1 into: ll_id;
Loop

The cursor (if there are five loops) the SQL access, ll_row variables can only take to 88, in the last four front is 0, do not know why


The code should be no problem, may be caused by the cursor

Suggest don't use cursor in pb use datawindow or datastore efficiency is higher than this

CodePudding user response:

The code seems to be no problem
But should be in the select count (*) into: ll_row from jc_gnzd; Check the query statement after the success, to determine ll_row content is correct
  • Related