The SQL::TableInfo Object
The SQL::TableInfo object returns information about a database table. It can be useful when importing data from or exporting data to back-end tables. The easiest way to get a SQL::TableInfo object is to use the SQL::Connection::GetTableInfo() method. The following code was run in the Interactive window.
|
dim conn as SQL::Connection dim ti as SQL::TableInfo |
Define the connection string and open the connection.
|
? conn.open("{A5API=Access,FileName='C:\Program Files\a5v8\MDBFiles\Alphasports.mdb',UserName='Admin'}") = .T. |
Note that the SQL::TableInfo object is passed as an argument, along with the name of the table to investigate.
|
? conn.GetTableInfo(ti, "customer") = .T. |
The PROPERTIES_ENUM() function returns a list of the object's properties and methods. Most of the items in this list are methods.
|
? properties_enum(ti) = Name Owner Comment Column Index DBFRowSyntax Updateable TableType TableTypeName NativeAPI NativeSyntax PrimaryKeySubscript ColumnNumber IndexNumber Clear AddColumn AddIndex CanUpdateInTransaction InsertColumn Clone SizeToFit UpdateStatistics LastKnownRowCount IdentityColumnSubscript UniqueName XML SelectRowLimit QueryAlias |
Some of the useful properties of the SQL::TableInfo object are listed below. The .DBFRowSyntax property shows how to define an Alpha Five table, so that it can receive data from the foreign table.
|
? ti.Name = "customer" ? ti.Updateable = .T. ? ti.NativeSyntax = "Access" ? ti.DBFRowSyntax = CUSTOMER_ID,N,10,0 FIRSTNAME,C,20,0 LASTNAME,C,20,0 COMPANY,C,32,0 PHONE,C,20,0 FAX,C,20,0 BILL_ADDRESS1,C,40,0 BILL_ADDRESS2,C,40,0 BILL_CITY,C,20,0 BILL_STATE_REGION,C,20,0 BILL_POSTAL_CODE,C,10,0 BILL_COUNTRY,C,20,0 SHIP_ADDRESS1,C,40,0 SHIP_ADDRESS2,C,40,0 SHIP_CITY,C,20,0 SHIP_STATE_REGION,C,20,0 SHIP_POSTAL_CODE,C,10,0 SHIP_COUNTRY,C,20,0 SHIP_SAME,L,1,0 EMAIL,C,60,0 |
Supported By
Alpha Five Version 8 Enterprise Edition
Limitations
Desktop applications only.
See Also