bigfrog 发表于 2015-3-3 22:06:09

关于参数传递到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吗?
普通窗口可以的
是什么问题





ehxz 发表于 2015-3-3 22:29:14

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()

bigfrog 发表于 2015-3-4 17:44:44

明白了,谢谢大大
我理解错了格式
不过,很奇怪,也能通过编译

ehxz 发表于 2015-3-4 18:29:22

PB的帮助还是很好的,有些要好好看。编译通过的,不一定就肯定没问题。所有的代码都可能这样。
多看一些别人写的,慢慢就学会好。PB上手还是快的很的。
页: [1]
查看完整版本: 关于参数传递到DW问题

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com