Previous Topic

Next Topic

Inhoudsopgave

Book Index

TIsahCDSStoredProcUpdateObject Component

TIsahCDSStoredProcUpdateObject

Description

TIsahCDSStoredProcUpdateObject provides functionality used to update datasets represented by a TIsahCDSQuery component using stored procedures.

Details

In practical application, a TIsahCDSStoredProcUpdateObject object is linked to a TIsahCDSQuery component through that component's UpdateObject property. The objects are used in combination with data-aware visual components. In fact the TEditForm and TProcesForm make also use of the TIsahCDSStoredProcUpdateObject component behind the scenes.

The update object actually encapsulates a TIsahStoredProc components. This component is used to execute one of the three stored procedures in the database. Each of these stored procedures perform a single update task. One stored procedure provides an UPDATE statement for modifying existing records; a second stored procedure provides an INSERT statement to add new records to a table; and a third stored procedure provides a DELETE statement to remove records from a table.

Isah framework functionality will be used to perform the tasks. An aliasname has to be specified to point to the ins/upd/del stored procedures.

TIsahCDSStoredProcUpdateObject Properties

Property Property Timestampfield: String (R/W)

Specifies the timestampfield of the table to be mutated.

Property Property TableName: String (R/W)

Specifies the tablename (without T_ prefix) to be mutated.

Property Property TableAlias: String (R/W)

Specifies the stored procedures (without IP_ prefix) to be used for the update tasks.

Property Property CustomizedSPName: Boolean (R/W)

Specifies if the stored procedures are with IP_ prefix (false) or with SIP_ prefix (true).

On a TEditForm, this property of the encapsulated TIsahCDSStoredProcUpdateObject component is set to true.

Code Snippet

Update with a TIsahCDSStoredProcUpdateObject component

...

Set quCurrency = IsahObjects.Get("TIsahCDSQuery")

With quCurrency

.Name = "quCurrency"

.DataBaseName = "dbIsahAdmin"

.SQL.Add "Select CurrCode"

.SQL.Add ", Description"

.SQL.Add ", ExchRate"

.SQL.Add ", EMUCurrInd"

.SQL.Add ", LastUpdatedOn"

.SQL.Add ", LastUpdatedBy"

.SQL.Add "From T_Currency "

.SQL.Add "Where CurrCode <> ''"

.StoredProc = 0

.UpdateObject = "uspCurrency"

End With

Set uspCurrency = IsahObjects.Get("TIsahCDSStoredProcUpdateObject ")

With uspCurrency

.Name = "uspCurrency"

.TableName = "Currency"

.TableAlias = "Currency"

.Left = 344

.Top = 8

End With

Set dsCurrency = IsahObjects.Get("TDataSource")

With dsCurrency

.Name = "dsCurrency"

.DataSet = "quCurrency"

End With

...