Now register code below
If sle_1. Text="" or sle_2. Text=" "then
Messagebox (hint! "" , "input box can't be empty!" , the exclamation! , ok! , 2)
The else
String cno
The select cno into: cno from sc where sno=: sle_1. Text and cno=: sle_2. Text;
If cno=sle_2. Text then
Messagebox (hint! "" , "you have chosen this course!" , the exclamation! , ok! , 2)
The else
Int number
Select count (*) into: number from c where cno=: sle_2. Text;
If the number=0 then
Messagebox (hint! "" , the course does not exist! "" , the exclamation! , ok! , 2)
The else
Insert into sc (sno, sname, cno, cname, score)
Values (: sle_1. Text: sle_2. Text, null);
End the if
End the if
End the if
Sle_2. Setfocus ()
Why don't choose the class code where there are problems
And I hope I can finish the scholarship query, the first requirement for each course result all pass, the second for average greater than 90 can you tell me the code should be how to write
I am writing but no
String SQL
SQL="select sc. * from sc where score>=60 and avg (score) & gt;
=90"Dw_1. Setsqlselect (SQL)
Dw_1. Retrieve ()
Pray god guide
CodePudding user response:
Problem a:Can't choose elective courses, specific tips?
Visual inspection, there are two problems, 1, generally define variables to obtain sle_1. The text, and then use variables for the back of the operation, 2, insert into sc (sno, sname, cno, cname, score) values (: sle_1. Text, : sle_2. Text, null); Also want to five values valus?
Problem two:
Did dw_1 settransobject ()?
If so, try ll_return=dw_1. Setsqlselect (SQL)
If ll_return less than zero, then there is something wrong with the SQL
If not less than zero, may be no data,
Specific issues, specific analysis,
CodePudding user response:
Try to write soThe select sc. Students from sc where score>=60 and avg (score) & gt;=90
Group by sc. Students
CodePudding user response:
The select sc. Students from sc where score>=60Group by sc. Student
Having avg (score) & gt;=90