注册 登录
编程论坛 PowerBuilder

单选控件的cheched问题请教

lichenbo 发布于 2006-07-24 19:07, 764 次点击

if rb_1.checked then
select * from company where comptype = '1';
dw_1.settransobject(sqlca)
dw_1.retrieve()
end if
我想实现当rb_1被选中时显示特定的数据记录,我写了这段代码他总提示我
select * from company where comptype = '1';
这句话中有语法错误
error c0031 syntax error

3 回复
#2
fgypblt2006-07-25 09:13

通过dw_1预设或赋予筛选条件。

error:
select * from company where comptype='1';
//select emp_name into :ls_emp_name from employee where .....
如果寻到的值可能不止一个,则考虑用数组配合dw_1定义或参照
本页"【求助] 求助!数据窗口查询的问题!已解决!" 主题内容
使用dw_emp.setsqlselect()

#3
潇洒老乌龟2006-07-25 22:06
if rb_1.checked then
select * from company where comptype = '1';
dw_1.settransobject(sqlca)
dw_1.retrieve()
end if

上面的select * from company where comptype = '1';
要用动态数据库完成.


#4
潇洒老乌龟2006-07-25 22:07

STRING Ls_Sql , Ls_Syntax , Ls_Error

Ls_Error = ""
Ls_Sql = "select * from company where comptype = '1'"
Ls_Syntax = SQLCA.SyntaxFromSql(Ls_Sql , "Style(Type=Grid)" , Ls_Error)
IF LEN(TRIM(Ls_Error)) > 0 THEN
MessageBox("系统提示!" , "语法有错!~r~n~r~n" + Ls_Error)
RETURN
END IF
Ls_Error = ""
//创建数据窗口
dw_1.Create(Ls_Syntax,Ls_Error)
IF LEN(TRIM(Ls_Error)) > 0 THEN
MessageBox("系统提示!" , "创建数据窗口出错!~r~n~r~n" + Ls_Error)
RETURN
END IF

1