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


The SQL command to run on the backend. This can be a SELECT statement or stored procedure call using standard ODBC/OleDB syntax.

The connection string to access the ODBC/OleDB datasource.

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.

The name of each row. Default is 'row'. If multiple resultsets are returned all of them will use the same row value.

The indent for the generated XML. Default: 0

Flag to optionally leave off the XML header.


lcXML = oXML.sqlcursortoxml("select * from authors","dsn=Pubs;uid=sa","authors","author")
oXML.ncreatedatastructure = 1   && Schema    

See also:

Class wwXML (High Level Methods)

© West Wind Technologies, 1996-2018 • Updated: 07/28/00
Comment or report problem with topic