随笔 - 6  文章 - 129  trackbacks - 0
<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 814157
  • 排名 - 49

最新评论

阅读排行榜

评论排行榜

//取得关键字的字段类型
ls_type1 = dw_base.Describe(""+scolumnname+".ColType")
ls_type2 = dw_base.Describe(""+sDispColumn+".ColType")
sdbColumnName=dw_base.Describe(""+scolumnname+".dbName")//关键字的字段名 Modify By GangL 04/12/06 PM 2:17
sdbDispColumn=dw_base.Describe(""+sDispColumn+".dbName")


long ll_found
IF not(isnull(ls_keyword) or ls_keyword = '')  then
 IF ls_type1 = 'long' THEN
  ll_found = dw_base.Find(""+sColumnName+" = "+ls_keyword+"",1,dw_base.RowCount())
 ELSE
  ll_found = dw_base.Find(""+sColumnName+" = '"+ls_keyword+"'",1,dw_base.RowCount())
 END IF
 dw_base.ScrollToRow(ll_found)
 dw_base.SetRow(ll_found)
 sle_1.setfocus()

PB数据窗口使用SetSqlSelect()函数应注意的问题

Limitations to using SetSQLSelectUse SetSQLSelect only if the data source for the DataWindow object is a SQL SELECT statement without retrieval arguments and you want PowerBuilder to modify the update information for the DataWindow object:

dw_1.Modify("DataWindow.Table.Select='select...'")

Modify will not verify the SELECT statement or change the update information, making it faster but more susceptible to user error. Although you can use Modify when arguments are involved, it is not recommended because of the lack of checking.

在脚本中修改数据窗口语法时,如果數據窗口沒有檢索條件,可以使用Getsqlselect读取sql语句,修改为自己需要的sql语句后可用Setsqlselect重新设置查询条件;也可以用MODIFY()函数修改,如设置不同的where条件,另外设置过后要恢复原来数据窗口的sql语句。

如果有检索条件就不能用setsqlselect

只可以用dw_1.Modify("DataWindow.Table.Select='select...'")

Eg

ls_original=dw_1.getsqlselect()

if rb_3.checked=true then //base salary

       ls_newsql=ls_original +" and (staff_master.monthly_pay=0 )"

else               // fixed salary

       ls_newsql=ls_original +" and (staff_master.monthly_pay in ('1','2','3') )"

end if

//int i

//i=dw_1.setsqlselect(ls_newsql) //// 数据窗口没有设置检索参数可以用setsqlselect

string ls_tmp

//ls_tmp="DataWindow.Table.Select='"+ls_newsql+"'"//// 加入的where条件中用到单引号‘’这时dw_1.Modify("DataWindow.Table.Select='select...'")中的单双引号应互换

ls_tmp='DataWindow.Table.Select="'+ls_newsql+'"'

ls_tmp=dw_1.Modify(ls_tmp) ////有检索参数就只能用dw_1.modify()

dw_1.setsqlselect(ls_original)



posted on 2010-06-29 16:09 Ke 阅读(793) 评论(0)  编辑  收藏 所属分类: powerBuilder

只有注册用户登录后才能发表评论。


网站导航: