我用pb9.0建了三個表學生(s)課程(c)成績(sc)
現在選課代碼如下
if sle_1.text=" " or sle_2.text=" " then
messagebox("提示!","輸入框不能為空!", exclamation!, ok!,2)
else
string cno
select cno into:cno from sc where sno=:sle_1.text and cno=:sle_2.text;
if cno=sle_2.text then
messagebox("提示!","您已經選過了該課程!",exclamation!,ok!,2)
else
int number
select count(*) into:number from c where cno=:sle_2.text;
if number=0 then
messagebox("提示!","該課程不存在!",exclamation!,ok!,2)
else
insert into sc(sno,sname,cno,cname,score)
values(:sle_1.text,:sle_2.text,null);
end if
end if
end if
sle_2.setfocus()
為什么選不了課代碼哪里有問題
還有我希望可以完成獎學金查詢,第一要求每門課成績都及格,第二要求平均分大于90請問代碼應該如何寫
我是這樣寫的可是不行
string sql
sql=" select sc. * from sc where score>=60 and avg(score)>=90"
dw_1.setsqlselect(sql)
dw_1.retrieve()
求大神指導
uj5u.com熱心網友回復:
問題一:選課選不了,具體提示的是什么?
目測有兩個問題。1、一般都會定義變數來獲取sle_1.text,然后再用變數來進行后面的操作。2、insert into sc(sno,sname,cno,cname,score) values(:sle_1.text,:sle_2.text,null);valus是不是也要五個值呢?
問題二:
dw_1有沒有settransobject()呢?
如果有的話,試試ll_return = dw_1.setsqlselect(sql)
如果ll_return小于0,則sql有問題
如果不小于0,則可能沒資料。
具體問題,具體分析。
uj5u.com熱心網友回復:
試試這么寫select sc.學生 from sc where score>=60 and avg(score)>=90
group by sc.學生
uj5u.com熱心網友回復:
select sc.學生 from sc where score>=60group by sc.學生
having avg(score)>=90
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/43287.html
標籤:基礎類
