1. time应能够不能加[]
2. lesson =:'' 应该去掉冒号:
3. v_count是数字,不能应该是 V_count =0
SELECT COUNT(1)
INTO :V_count
FROM db_schedule
where classroom =:ls_classroom and time =:ls_time and ( lesson ='' or lesson is null );
if V_count =0 then
messagebox('警告','教室已用!')
end if
PB里面如果需要直接对数据库查询的话应先预定义SQL连接,指定你要对哪个数据库连接 ,例如定义连接为SQL1
则你的语句应为
SELECT COUNT(1)
INTO :V_count
FROM db_schedule
where classroom =: ls_classroom and [time] =: ls_time and ( lesson ='' or lesson is null ) using sql1;
if V_count ='0' then
messagebox('警告','教室已用!')
end if
SELECT COUNT(1)
INTO :V_count
FROM db_schedule
where classroom =:ls_classroom and [time] =:ls_time and ( lesson ='' or lesson is null );
if V_count =0 then
messagebox('警告','教室已用!')
end if
这样写应该就可以