如何使动态创建的DataWindow可修改,PowerBuilder,数据库 在线留言 | Alexa查询 | 在线工具 | 技术论坛 | 会员注册 | 繁文 首页 WEB编程 WEB设计 WEB标准 脚本特效 WEB安全 数据库 开发工具 资源下载 WEB资讯 欢迎访问阿里西西WEB开发技术网站! → ASP编程| PHP编程| JSP编程| ASP.NET| C#.NET| VB.NET| Cgi/Perl| XML/RSS| → WEB设计软件| WEB设计艺术| WEB设计规范| WEB设计欣赏| → HTML| XHTML| CSS样式表| → JavaScript| VBScript| → WEB服务器| WEB黑客攻防| WEB攻防工具| → ACCESS| MSSQL| MySQL| Oracle| PowerBuilder| FoxPro| DB2| → Dreamweaver| FrontPage| Fireworks| FLASH| Ultradev| 精品工具| → 电子教程手册| 语言参考手册| 网站开发文档| 精典源码函数| → 互联网新闻| WEB市场推广| WEB程序员专栏| ACCESS MSSQL MySQL Oracle PowerBuilder FoxPro DB2 首页 / 数据库 / PowerBuilder / [PowerBuilder] 如何使动态创建的DataWindow可修改 作者:[转载] 文章来源:http://www.alixixi.com/ 更新时间:2005-12-13 aking Dynamically Created DataWindows Updateable SUMMARY: To make a dynamic datawindow updateable, several settings are necessary before calling dw_control.Update(). This document explains the way to do this. Document ID: 47794 Last Revised: 03/13/98 Topic: DataWindows Document Type: Tip Product: PowerBuilder Version: 6.0 Platform: PC Operating System: Windows 3.1, Windows 95, Windows NT Document: To make a dynamic datawindow updateable, several settings are necessary before calling dw_control.Update(). First you set the column(s) as updateable: dw_control.Object.<columnname>.update or dw_control.Modify("<ColumnName>.Update=Yes") This is similar to selecting a column in the "Updateable Columns" listbox in the Update Properties dialogue box. It is assumed that all the updateable columns are in the same table. Call this line for each column you want to be able to update. Next you set which column is the primary key: dw_control.Object.<ColumnName>.key = "yes" This is similar to selecting a column in the "Unique Key Columns" listbox in the Update Properties dialogue box. Then you set a WHERE clause update method: dw_1.Object.DataWindow.Table.UpdateWhere = 0 or 1 or 2 This sets key, key & updateable, key & modified respectively. Notice we are setting a table property here. Then you can call dw_control.Update() Optionally, you can set Update Key In Place with: Dw_control.object.DataWindow.Table. UpdateKeyInPlace = "yes" or "no" This is the same as the two radio buttons in the Update Properties box>Key Modification group box. From PowerBuilder Help: "Whether the key column can be updated in place or whether the row has to be deleted and reinserted. This value determines the syntax PowerBuilder will generate when a user modifies a key field. Yes - Use the UPDATE statement when the key is changed so that the key is updated in place. No - Use a DELETE and an INSERT statement when the key is changed Caution When there are multiple rows in a DataWindow object and the user switches keys or rows, updating in place may fail due to DBMS duplicate restrictions." Here is sample code I used in a command button with the PB Demo DB, Department table. It makes the dept_name column updateable, updating on key only and identifies the dept_id column as the key: dw_1.Object.DataWindow.Table.UpdateWhere = 0 dw_1.object.dept_name.update = "yes" dw_1.Object.dept_id.key = "yes" dw_1.update() 【发表评论】 【加入收藏】 【打印此文】 【关闭窗口】 上一篇:如何实现数据的自动录入 [2005-12-13] 下一篇:如何使用 query mode [2005-12-13] 网友评论 相关搜索 关于我们|网站地图|隐私和安全性|联系我们|在线工具|友情链接|粤ICP备05097432号 ©2004-2005 Alixixi Development Team.All rights reserved 保留所有权利。 访问本网站表明您同意信息使用条款。