SQL::ResultSet::ToXML()
Syntax
XML_String as C = <SQL::ResultSet>.ToXML( [ RowsToCopy as N [, StartRow as N [, DocumentName as C [, RowName as C [, Header as C [, ReferenceColumns as SQL::TableInfo [, UserContext as P ]]]]]]] )
|
Argument |
Description |
|
XML_String |
The XML formatted data returned by the query. |
|
<SQL::ResultSet> |
A SQL::ResultSet object created with a DIM statement. |
|
RowsToCopy |
Optional. Default = -1. The number of rows to copy. |
|
StartRow |
Optional. Default = 1. The first row to copy. |
|
DocumentName |
Optional. The tag for the document element. See example. |
|
RowName |
Optional. The tag for the row element. See example. |
|
Header |
Optional. The tag for the header element. See example. |
|
ReferenceColumns |
Optional. A SQL::TableInfo object. When data is formatted for a column in the result set: (1) if ReferenceColumns has a column with a matching name, that object will be used to format the data; (2) otherwise the ColumnInfo property of the result set is used to format the data. |
|
UserContext |
Optional. The user context is passed into the evaluation of the expression when data is formatted. |
Description
The ToXML() method converts a SQL::ResultSet object to a XML formatted string.
Example
|
dim conn as SQL::Connection dim rs as SQL::ResultSet dim connString as C dim select_exp as C dim ti as SQL::TableInfo connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}" select_exp = "select * from customer where bill_state_region = 'ny'" 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 ti = rs.ToTableInfo() ui_msg_box("XML Data", rs.toxml(-1, -1, "DocName", "RowName", "HeaderName")) conn.close() |
The XML data looks like this:
|
HeaderName <DocName> <RowName> <Firstname>Michael</Firstname> <Lastname>Graham</Lastname> </RowName> <RowName> <Firstname>Sally</Firstname> <Lastname>Peabody</Lastname> </RowName> ... |
See Also
Supported By
Alpha Five Version 8 Enterprise Edition
Limitations
Desktop applications only.