Consultor Eletrônico



Kbase P108707: How to use ROWID data type with ActiveX open client ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/27/2005
Status: Unverified

GOAL:

How to use ROWID data type with ActiveX open client ?

GOAL:

How to retrieve a ROWID field in a temp-table using an ActiveX open client like Visual Basic

FACT(s) (Environment):

Progress 9.1x

FIX:

In Visual basic, a ROWID Progress Data type is represented by a Variant (byte array).


See below a Visual Basic sample code allowing to access to a ROWID field of a temp-table.

Dim ao As CaoTestRowid
Dim ttTest As CProTempTable

Dim moreRecord As Boolean
Dim i As Integer

Dim ColumnData As Variant
Dim ColRowid As Variant
Dim cRowid As String

Set ao = New CaoTestRowid

Call ao.OC_Connect("AppServer://localhost:5162/asbroker1", "", "", "")

Set ttTest = New CProTempTable

' Return the Temp-Table (OUTPUT)
Call ao.getTblRowid(ttTest)

moreRecord = ttTest.MoveNext

While moreRecord
' Get a row of data, one Variant per field.
ColumnData = ttTest.GetRow

' Get the ROWID which is the 2nd column
ColRowid = ColumnData(1)

' ROWID is a variant array of 4 bytes
For i = 0 To 3
cRowid = cRowid + CStr(ColRowid(i))
Next i

' Display the ROWID in hexa
MsgBox Hex(cRowid)

' Move to the next record in the result set
moreRecord = ttTest.MoveNext
Wend

Call ao.OC_Release


See below the 4GL code, 'getTblRowid.p':

DEFINE TEMP-TABLE ttTest
FIELD F1 AS INTEGER
FIELD F2 AS ROWID.

DEFINE OUTPUT PARAMETER TABLE FOR ttTest.

FIND FIRST customer .
IF AVAILABLE(customer) THEN DO:
CREATE ttTest.
ASSIGN ttTest.F1 = customer.custnum
ttTest.F2 = ROWID(customer).
END.