setsqlselect()的问题
有2个表
teacher
{
T# //教师号
tname //教师姓名
}
course
{
cname char(10) //课程名
T# char(10)(teacher的外码)
}
根据教师号查询教师姓名和课程。要求要有动态SQL语句
我的代码不知道哪里错了
string code
string old_select
string condition
string tmp1, tmp2, tmp3
tmp1 = trim(sle_1.text)
select tname
into :tmp2
from teacher
where trim(t#) =:tmp1;
select cname
into :tmp3
from course
where trim(t#) =:tmp1;
old_select = dw_1.getsqlselect()
condition = "where teacher.tname = '"+tmp2+"'"
condition += "and teacher.cname = '"+tmp3+"'"
condition = old_select + condition
dw_1.setsqlselect(condition)
dw_1.retrieve()