This method allows you to directly query an ODBC/OleDB data source and return XML for a query or stored procedure result. The data is returned as an XML string in standard format.
If you run a stored procedure and multiple resultsets are returned, all resultsets are encoded into the single XML document below the document element. The naming will be 'name', 'name1', 'name2' and so on for each subsequent resultset. The structures for the result sets may vary, but the table and row names will be the same for each. Field names will vary.
o.SQLCursorToXML(lcSQL, lcConnectString, lcName, lcRowName, lnIndent, llNoHeader)
Return Value
XML string of the result set
Parameters
lcSQL
The SQL command to run on the backend. This can be a SELECT statement or stored procedure call using standard ODBC/OleDB syntax.
lcConnectString
The connection string to access the ODBC/OleDB datasource.
lcName
Name of the 'table' level element. By default this will be the name of the cursor. If multiple resultsets are returned the name will be 'name', 'name1', 'name2'. Each resultset will get its own XML fragment subtree below the document element.
lcRowName
The name of each row. Default is 'row'. If multiple resultsets are returned all of them will use the same row value.
lnIndent
The indent for the generated XML. Default: 0
llNoHeader
Flag to optionally leave off the XML header.
Example
oXML = CREATEOBJECT("wwXML") lcXML = oXML.sqlcursortoxml("select * from authors","dsn=Pubs;uid=sa","authors","author") oXML.ncreatedatastructure = 1 && Schema ShowXML(lcXML)
See also:
Class wwXML (High Level Methods)© West Wind Technologies, 1996-2024 • Updated: 07/28/00
Comment or report problem with topic