Xbasic
SQL::ResultSetToPropertyArray Method
Syntax
Result as L = ToPropertyArray(Array as p[] [, RowsToCopy = -1 as N [, StartRow = -1 as N ]])
Arguments
- ArrayPointer Array
A pointer array to populate with the data in the result set.
- RowsToCopy
Default = -1. The number of rows to copy. A value of -1 will copy all rows.
- StartRow
Default = 1. The first row to copy.
Returns
- ResultLogical
TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).
Description
Convert the ResultSet to a property array.
Discussion
The ToPropertyArray() method creates pointer elements named after the names of the table field. It replaces spaces in names with underscores.
Example
dim conn as SQL::Connection
dim rs as SQL::ResultSet
dim connString as C
dim select_exp as C
dim arr[0] as P
connString = "::Name::AADemo-Northwind"
select_exp = "select * from customers where country='France'"
if .not. conn.open(connString)
ui_msg_box("Error", conn.CallResult.text)
end
end if
if .not. conn.execute(select_exp)
ui_msg_box("Error", conn.CallResult.text)
conn.close()
end
end if
rs = conn.ResultSet
rs.ToPropertyArray(arr)
conn.close()
ui_msg_box("Results", arr.dump_properties("CustomerID ContactName, City"))