[参考]:《Power Builder Help》(8.0)
Objects and Controls —— System Object Properties, Events, and Functions —— Transaction object
DataWindow Reference —— Methods for the DataWindow Control —— Create method
DataWindow Reference —— DataWindow Object Properties —— Controls in a DataWindow and their properties —— Properties for the DataWindow object
SyntaxFromSQL
Description: Generates DataWindow source code based on a SQL SELECT statement.
Syntax: transaction.SyntaxFromSQL(sqlselect,presentation,err)
Argument
transaction: The name of a connected transaction object
sqlselect: A string whose value is valid SQL SELECT statement
presentation: A string whose value is the default presentation style you want for the DatWindow.The simple format is: Style(Type=presentationstyle)
Keywords are: (Default) Tabular
Grid
Form(for freeform)
Graph
Group
Label
Nup
err: A string variable to which PowerBuilder will assign any error message that occur
Return value
string
"" —— error occurs
NULL —— argument's value is NULL
Create method (DataWindows)
Description: Creates a DataWindow object using DataWindow source code and puts that object in the specified DataWindow control or DataStore object. This dynamic DataWindow object does not become a permanent part of the application source library.
Syntax: integer dwcontrol.Create(string syntax{,string errorbuffer})
Argument
syntax: A string whose value is the DataWindow source code that will be used to create the DataWindow object
errorbuffer: The name of a string that will hold any error message that occur.
Table.property
Description: Properties for the DataWindow's DBMS connection.
Syntax: dw_control.Object.DataWindow.Table.property
(表的属性很多,在此不列举,请参考帮助)
SetTransObject method (DataWindows)
Description: Causes a DataWindow control or DataStore to use a programer-specified transaction object.
Syntax: integer dwcontrol.SetTransObject(transaction transaction)
Return value
1 —— succeeds
-1 —— error occurs
NULL —— argument's value is NULL
Retrieve method (DataWindows)
Description: Retrieves rows from the database for a DataWindow control or DataStore.
Syntax: long dwcontrol.Retrieve({any argument,any argument ...})
Return value
The number of rows displayed —— succeeds
-1 —— fails
[简单示例]:
本文介绍了如何通过PowerBuilder的Transaction对象的SyntaxFromSQL方法,根据SQL SELECT语句生成DataWindow源代码,然后利用DataWindow的Create方法创建动态DataWindow对象。同时,详细讲解了SetTransObject和Retrieve方法的用法,用于设置数据窗口的事务对象并从数据库检索数据。
3878

被折叠的 条评论
为什么被折叠?



