精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● Powerbuilder>>数据窗口>>如何用modify()动态修改where条件?

主题:如何用modify()动态修改where条件?
发信人: zhangzf()
整理人: leitiger(2002-06-05 23:47:38), 站内信件
【 在 joly (joly) 的大作中提到: 】
: 我定义了一个数据窗口,where条件要在程序中实现修改,
: 我用describe()函数得到此DW的描述,但是在用modify(newsql)
: 修改时总是差一层引号,“slkadf"a's'df"asdf”,这儿我用
: 汉字库中的引号代替最外层的英文引号,请问有什么办法能够
:    .......
The original SELECT statement might be:

SELECT employee.emp_id, employee.l_name

FROM employee

Presumably, the application builds a WHERE clause based on the user's 
choices. The WHERE clause might be:

WHERE emp_id > 40000

The script for the window's Open event stores the original SELECT stat
ement in original_select, an instance variable:

dw_emp.SetTransObject(SQLCA)

original_select = &
dw_emp.Describe("DataWindow.Table.Select")

The script for a CommandButton's Clicked event attaches a WHERE clause
 stored in the instance variable where_clause to original_select and a
ssigns it to the DataWindow's Table.Select property:

string rc, mod_string

mod_string = "DataWindow.Table.Select='" &
+ original_select + where_clause + "'"

rc = dw_emp.Modify(mod_string)

IF rc = "" THEN
dw_emp.Retrieve( )

ELSE
MessageBox("Status", "Modify Failed" + rc)

END IF

Quotes inserted in the DataWindow painter  For SQL Anywhere and ORACLE
, the DataWindow painter puts double quotes around the table and colum
n name (for example, SELECT "EMPLOYEE"."EMP_LNAME"). Unless you have r
emoved the quotes, the sample WHERE clause must also use these quotes.
 For example: 

where_clause = &

" where ~~~"EMPLOYEE~~~".~~~"SALARY~~~" > 40000"



--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.102.3.210]

[关闭][返回]