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()
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()
...全文
相关推荐
如何给字符型字段以自定义初始值
这对于调试和问题解决非常重要,特别是在数据库操作或者数据验证过程中。### 2.
PB中的六种查询技术new
**GetSqlSelect() 和 SetSqlSelect()**: 这些函数允许开发者获取或设置DataWindow的SQL选择语句。
关于pb的小例子
```powerbuilder dw_1.setsqlselect(ls_sql_new) ```至此,数据窗口将按照新的SQL语句重新加载数据,实现了动态过滤的功能。
PB数据窗口
- **GetSQLSelect/SetSQLSelect**:获取或设置数据窗口的SQL查询语句。 - **GroupCalc**:重新计算数据窗口的分组结果。
powerbuilder中如何动态设置数据窗口SQL
在PowerBuilder中,你可以动态地设置数据窗口(DataWindow)的SQL查询语句。通过以上步骤,你可以在PowerBuilder中动态设置数据窗口对象。请注意,上述示例仅提供了一个基本的框架,你需要根据你的具体需求进行适当的修改和扩展。首先,在你的PowerBuilder应用程序中创建一个数据窗口控件,例如。方法,将构建的SQL查询语句设置为数据窗口的SQL查询语句。最后,记得在适当的时候销毁动态创建的对象,以释放资源。或者,如果你已经有一个现有的数据窗口对象,你可以使用。


