Retrieving Data to a Property Array
Description
Retrieving data to a property array allows you to immediately manipulate it with your program. First, create a SQL::Connection() object and a pointer array to receive the data. The array only needs to have a single element.
dim conn as SQL::Connection dim qry as C dim dat[1] as P qry = "Select * from Customer"
Define the connection string and open the connection.
? conn.open("{A5API=Access,FileName='C:\Program Files\a5v8\MDBFiles\Alphasports.mdb',UserName='Admin'}") = .T.
Retrieve the data with SQL::Connection::ToPropertyArray() and look at a sample record.
? conn.ToPropertyArray(qry, dat) = .T. ? dat[3] = BILL_ADDRESS1 = "37 Washington Post Road" BILL_ADDRESS2 = "Apt. 18" BILL_CITY = "Keene" BILL_COUNTRY = "" BILL_POSTAL_CODE = "03431" BILL_STATE_REGION = "NH" COMPANY = "" CUSTOMER_ID = 3 EMAIL = "" FAX = "" FIRSTNAME = "Janet" LASTNAME = "Rebo" PHONE = "(603) 555-7100" SHIP_ADDRESS1 = "" SHIP_ADDRESS2 = "" SHIP_CITY = "" SHIP_COUNTRY = "" SHIP_POSTAL_CODE = "" SHIP_SAME = .T. SHIP_STATE_REGION = ""
Look at a single field value.
? dat[3].lastname = "Rebo"
Close the connection.
conn.close()
See Also