setsqlselect()的问题

novice2008 novice2008 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
有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()
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
novice2008
PowerBuilder 1,111 成员 66,454 内容