SQL::ResultSetToOpenTable Method
Syntax
Arguments
- Table
A pointer to an open DBF table. The column types in the result set must match the respective column in the table.
- EventScript
Optional. Default = "". An Xbasic Script implementing any of the following functions. In each case, the Context argument is the connection itself.
- UpdateBegin()
- UpdateProgress()
- UpdateEnd()
- Rows
Optional. Default = -1 (all). The number of rows to copy.
- StartRow
Optional. Default = -1 (first). The first row to copy.
- Append
Optional. Default = .T. . Whether to append the data to the Table.
- MapByPosition
Optional. Default = .F. . If MapByPosition is false (the default) only column names in the result set that match a local table column will be copied.
Returns
- ResultLogical
TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).
Description
Fetch data from a result set to an open .DBF table
Discussion
The ToOpenTable() method fetches data from the current SQL::ResultSet to an existing and open .DBF table. Columns in the query must match the type of the columns in the table. The query must not have more columns than the table.
Example
dim conn as SQL::Connection dim rs as SQL::ResultSet dim connString as C dim select_exp as C dim tbl as P connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}" select_exp = "select firstname, lastname, phone from customer where bill_state_region = 'ny'" tbl = table.open("customer") 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) goto close_script end if rs = conn.ResultSet if .not. rs.ToOpenTable(tbl, "", -1, -1, .T., .T.) ui_msg_box("Error", rs.CallResult.text) end if close_script: tbl.close() conn.close()
Limitations
Not supported in Community Edition