十万里加急 ! 谁来说说 ShareData() 有什么用 , 一般用在什么情总下?

rongrong 2002-04-08 07:55:35

十万里加急 ! 谁来说说 ShareData() 有什么用 , 一般用在什么情总下?
...全文
145 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
圣殿骑士18 2002-04-13
  • 打赏
  • 举报
回复
才看到,交货了吧,呵呵:)
liuzxit 2002-04-13
  • 打赏
  • 举报
回复
sharedata即共享數據﹐就是把dw_2的數據源取自dw_1而不是取自數據庫。
我用到的其中一種情況﹕
我在窗體左邊dw_list(grid格式),列舉所有工號﹐姓名﹐部門等簡要資料﹐在右邊是一個dw_detail(frame格式),編輯瀏覽員工的詳細資料(性別學歷簡歷等一大板內容)這樣我增刪改右邊的內容左邊的也同步﹐點選左邊的資料右邊也顯示響應詳細資料。
還有打印很經常用到﹐而后台打印則有時還配合DATASTORE。
zhanwei 2002-04-11
  • 打赏
  • 举报
回复
The columns must be the same for the DataWindow objects in the primary and secondary DataWindow controls, but the SELECT statements may be different. For example, you could share data between DataWindow objects with these SELECT statements:

SELECT dept_id from dept

SELECT dept_id from dept where dept_id = 200
SELECT dept_id from employee

WHERE clause in secondary has no effect The WHERE clause in the DataWindow object in the secondary DataWindow control has no effect on the number of rows returned. The number of rows returned to both DataWindow controls is determined by the WHERE clause in the primary DataWindow object.

You could also share data with a DataWindow object that has a script data source and a column defined to be like the dept_id column.
To share data between a primary DataWindow and more than one secondary DataWindow control, call ShareData for each secondary DataWindow control.
To turn off sharing in a primary or secondary DataWindow, call the ShareDataOff function. When sharing is turned off for the primary DataWindow, the secondary DataWindows are disconnected and the data disappears. However, turning off sharing for a secondary DataWindow does not affect the data in the primary DataWindow or other secondary DataWindows.

When you call functions in either the primary or secondary DataWindow that change the data, PowerBuilder applies them to the primary DataWindow control and all secondary DataWindow controls are affected. For example, when you call any of the following functions for a secondary DataWindow control, PowerBuilder applies it to the primary DataWindow. Therefore, all messages normally associated with the function go to the primary DataWindow control. Such functions include:

DeleteRow
Filter
GetSQLSelect
ImportFile
ImportString
ImportClipboard
InsertRow
ReselectRow
Reset
Retrieve
SetFilter
SetSort
SetSQLSelect
Sort
Update

Computed fields in secondary DataWindow controls A secondary DataWindow control can only have data which is in the primary DataWindow control. If you add a computed field to a secondary control, it will not display when you run the application unless you also add it to the primary control.

Query mode and secondary DataWindows When you are sharing data, you cannot turn on query mode for a secondary DataWindow. Trying to set the QueryMode or QuerySort properties results in an error.

To share data between a DataStore or DataWindow and a RichTextEdit control, use the DataSource function.

Crosstab DataWindows You cannot use ShareData with Crosstab DataWindows.

Distributed applications You cannot share data between a DataWindow control in a client application and a DataStore in a server application.
is_null 2002-04-11
  • 打赏
  • 举报
回复
我常常在打印和显示风格不同的时候用。即select语句相同,显示不同的时候用,比如一个数据窗口是grid方式,另一个是用于打印的freedom风格,或是显示汇总值等时,sharedate就是用于共享数据的。
ustczhangguo 2002-04-11
  • 打赏
  • 举报
回复
同样的数据源.不同的表示方式时也会用
xingxing 2002-04-11
  • 打赏
  • 举报
回复
共享别的数据窗口和数据存储的数据,就是这样呀,仅仅是共享。主要是减少retrieve.
banalman 2002-04-08
  • 打赏
  • 举报
回复
sharedate 用在更新常常这样 :一个数据窗用做更新用,另外的几个数据窗共享此数据窗缓冲区,这样用户在任何一数据窗入录的数据其实都放置在一个缓冲区里面,这样用一个数据窗更新即可,尤其对多字段的表。
所说未必准确,但意思差不多!希望对您有所帮助!
rongrong 2002-04-08
  • 打赏
  • 举报
回复
TO : daixf_csdn(凌波微步)

麻烦把第二点 "尽量" 说详细点 , 我要问的就是这个 。

明天就要交货了 !!!




圣殿骑士18 2002-04-08
  • 打赏
  • 举报
回复
共享数据,dw_1.sharedata(dw_2)
表示dw_2显示的是dw_1缓冲区中的数据。
我一般用它在
1。需要多次检索而数据差不多的地方,尽量用sharedata
2。多个地方(比如多个dw)要同时修改一个表时,可以用他。
think_js 2002-04-08
  • 打赏
  • 举报
回复
共享另外一个数据窗口的数据啦,!可以用做打印

1,079

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧