关于参数传递到DW问题
普通窗口如图查询按钮的代码如下:string li_no
li_no=sle_100.text
openwithparm(w_em_modi,li_no) //传递字符型数据
w_em_modi的open事件代码为
dw_1.settransobject(sqlca)
string li_no
li_no=message.stringparm //接受字符
以下是老大那偷的:)
dw_1.setfilter("姓名 =li_no")//查询条件
dw_1.filter()//过滤
dw_1.retrieve() //执行在数据窗口显示
出现以下错误
难道参数传递不能到DW吗?
普通窗口可以的
是什么问题
dw_1.setfilter("姓名 =li_no")//查询条件
上面这行有问题,请仔细看一下PB自带的帮助,注意相关的语法。
PowerBuilder This statement defines the filter expression for dw_Employee as the value of format1:
dw_Employee.SetFilter(format1)
The following statements define a filter expression and set it as the filter for dw_Employee. With this filter, only those rows in which the cust_qty column exceeds 100 and the cust_code column exceeds 30 are displayed. The final statement calls Filter to apply the filter:
string DWfilter2
DWfilter2 = "cust_qty > 100 and cust_code >30"
dw_Employee.SetFilter(DWfilter2)
dw_Employee.Filter( )
The following statements define a filter so that emp_state of dw_Employee displays only if it is equal to the value of var1 (in this case ME for Maine). The filter expression passed to SetFilter is emp_state = ME:
string Var1
Var1 = "ME"
dw_Employee.SetFilter("emp_state = '"+ var1 +" '")
The following statements define a filter so that column 1 must equal the value in min_qty and column 2 must equal the value in max_qty to pass the filter. The resulting filter expression is:
#1=100 and #2=1000
The sample code is:
integer max_qty, min_qty
min_qty = 100
max_qty = 1000
dw_inv.SetFilter("#1="+ String( min_qty) &
+ " and #2=" + String(max_qty))
The following example sets the filter expression to null, which causes PowerBuilder to display the Specify Filter dialog box. Then it calls Filter, which applies the filter expression the user specified:
string null_str
SetNull(null_str)
dw_main.SetFilter(null_str)
dw_main.Filter()
明白了,谢谢大大
我理解错了格式
不过,很奇怪,也能通过编译
PB的帮助还是很好的,有些要好好看。编译通过的,不一定就肯定没问题。所有的代码都可能这样。
多看一些别人写的,慢慢就学会好。PB上手还是快的很的。
页:
[1]