Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program Freezes when i try to open a window?

Status
Not open for further replies.

trdin

Programmer
Jan 19, 2004
13
0
0
VE
Hey guys,

I open a window containing a form for input, after i write the input on the first field, i call on a function that uses that input to display on a pop-up window information regarding that input. For some reason after i do the input on the field, my program freezes righ before it open the pop-up window and i can't do nothing, i have to disconnect to be able to do anything. Before a open the pop-up window my code looks like this:

LET sqlstat = "SELECT MAX(price) from orders where order ='",order_n CLIPPED,"'" #order_n is the input from the form
PREPARE sq FROM sqlstat
DECLARE cur1 SCROLL CURSOR FOR sq
open cur1
fetch cur1 into max_price #value from the query
close cur1

OPEN WINDOW pop AT 10,13
with 12 rows,40 columns
attribute (border, MESSAGE LINE FIRST+1,PROMPT LINE FIRST+2)
MESSAGE "The max price is ",max_price CLIPPED
PROMPT "Hit any key to continue" FOR ans

This is just a test i am doing for another program, so right after i do the input on the form it completely freezes and the odd thing is that it was working perfectly a few days ago, i don't think the problem is in the code, could it be something else?

Thanks,

trdin
 
Hey,

I was doing some testing and the program freezes when it gets to the part where the cursor is open, maybe it helps to know that?, i really don't know what could be wrong.

trdin.
 
Hi:

First, I'm assuming your sqlstat is long enough to hold your string? Hey, I had to ask -)

Second, I'm assuming that order_n is a character string since you're clipping it and placing single quotes around it. This cursor looks like it should work. Since I don't see anything wrong with your code, "let's grab at some straws":

# untested
1) Try using double quotes around order_n:
LET sqlstat = "SELECT MAX(price) from orders where order = \"", order_n CLIPPED,"\""

2) Set up your cursor to a host variable:
LET sqlstat = "SELECT MAX(price) from orders where order = ?"
PREPARE sq FROM sqlstat
DECLARE cur1 SCROLL CURSOR FOR sq
open cur1 USING order_n
fetch cur1 into max_price #value from the query
close cur1

# the above code is untested. You might require quotes around ? but I doubt it:
LET sqlstat = "SELECT MAX(price) from orders where order = \"?\""

Regards,


Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top