Hi. I'm consulting a database thru a datawindow. The user enters the number of a item, if it is out of range(if the number exceds or is lower of the registries in the db), a messagebox is showed. I tested it a couple of times, and i don't know why I get aleatory registries showed without any reason while the condition is passed
Below is my code: (clicked event of my button)
if sle_1.text="" then //if the user doesn't enter any number, I'll don't do anything
return 0;
else
if correl>=1 and correl<=il_max_correl then //if number is on the range
select buque
into:xg
from alumnospb.if_bq_bqs
where buque=:correl;
if isnull(xg) or xg=0 then //if the registry doesn't exist
messagebox("error", "registry not found")
do while isnull(xg) or xg=0 //I'll show the next item
correl++
select buque
into:xg
from alumnospb.if_bq_bqs
where buque=:correl;
loop
dw_1.retrieve(correl ) //shows the next item that exists
var=correl //I need correl for another consults
sle_1.text=""
else
dw_1.retrieve(xg) //shows the item if it does exists
sle_1.text=""
end if
else
messagebox("error", "registry out of range")
sle_1.text=""
dw_1.reset()
correl=0 //correl is always 0 before the event is activated!!!
end if
end if
xg=0
//if I start making a lot of consults that are out of range I ocassionaly get some weird numbers God know how powerbuilder obtains it. I'm pretty sure it is caused by a bug. Am I right?
Below is my code: (clicked event of my button)
if sle_1.text="" then //if the user doesn't enter any number, I'll don't do anything
return 0;
else
if correl>=1 and correl<=il_max_correl then //if number is on the range
select buque
into:xg
from alumnospb.if_bq_bqs
where buque=:correl;
if isnull(xg) or xg=0 then //if the registry doesn't exist
messagebox("error", "registry not found")
do while isnull(xg) or xg=0 //I'll show the next item
correl++
select buque
into:xg
from alumnospb.if_bq_bqs
where buque=:correl;
loop
dw_1.retrieve(correl ) //shows the next item that exists
var=correl //I need correl for another consults
sle_1.text=""
else
dw_1.retrieve(xg) //shows the item if it does exists
sle_1.text=""
end if
else
messagebox("error", "registry out of range")
sle_1.text=""
dw_1.reset()
correl=0 //correl is always 0 before the event is activated!!!
end if
end if
xg=0
//if I start making a lot of consults that are out of range I ocassionaly get some weird numbers God know how powerbuilder obtains it. I'm pretty sure it is caused by a bug. Am I right?