ProductsTechnical SupportDownloadsPurchasingSearch EngineNewsHomeE-mail Us

Here is an example of code used with PowerBuilder (that fills a listbox control with contents of a file).

integer result
integer i
string name
string value
string class
string disp
pointer oldpointer

OLEObject ACE400
OLEObject db
OLEObject table
OLEObject field

ACE400 = CREATE OLEObject
result = ACE400.ConnectToNewObject( &
"ACE400.ACE400")
oldpointer = SetPointer(HourGlass!)

db = ACE400.OpenDatabase()
table = db.OpenRecordset(editfn.Text)

lbdata.Reset()
disp = ""

for i = 0 to Table.Fields.Count -1
disp = disp+ string(Table.Fields.Item(i).Name)+char(9)
next

if not cb_readonly.Checked then
lbdata.AddItem(disp)
end if

Table.MoveFirst()
do while not table.EOF
disp = ""
for i = 0 to Table.Fields.Count -1
value = string(Table.Fields.Item(i).Value)
if not cb_readonly.Checked then
disp = disp+value+char(9)
end if
next
if not cb_readonly.Checked then
lbdata.AddItem(disp)
end if

Table.MoveNext()
loop

Table.Close
SetPointer(oldpointer)

destroy ACE400

In this sample, all data is converted to strings. It is possible to check data types (to make conversion to Powerbuilder types) with the function ‘ClassName’.

Back Visual Basic Excel and VBA Applications VBScript Visual C++