Using SQL2000, returning an XML document (string) instead of a recordset, from a stored procedure 
Author Message
 Using SQL2000, returning an XML document (string) instead of a recordset, from a stored procedure

I'm trying to call a stored procedure in a function (in VB6), and have it
return the data from that stored procedure.

As I originally wrote it, the stored procedure consists of little more than
a SELECT statement, and then returns a recordset object.

However, recently I decided to add a FOR XML AUTO clause to the SELECT, so
it would return XML data.

But I can't figure out how to change my code to return the XML string
instead of the recordset.

The VB code (returning the recordset) is as follows:

Public Function GetList(ByVal strPersonID As String) As ADODB.Recordset

    Dim cmd As ADODB.Command
    Dim rst As ADODB.Recordset

    Set cmd = New ADODB.Command

    OpenDBConnections ' Set up ADODB.Connection object called connDB, and
create connection string for that
                                            '  object, and open the
connection.

    With cmd
        Set .ActiveConnection = connDB
        .CommandText = "dbo.GetList"
        .CommandType = adCmdStoredProc
        .Parameters.Append .CreateParameter("PersonID", adGUID,
adParamInput, 50, strPersonID)
        Set rst = .Execute
    End With

    Set GetEntryList = rst

End Function

What do I need to change, as to return the XML string instead? Obviously,
I'd change the output of this particular function. But it's the returning
from the .EXECUTE call that I'm a little foggy on.

Thanks!
-Scott



Wed, 05 Oct 2005 11:52:35 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. how we can return XML String instead of RecordSet

2. how we can return XML String instead of RecordSet

3. Using SQL 2000, returning an XML document (string) instead of a recordset, from a stored procedure, in VB6

4. XML document from SQL2000

5. XML From SQL2000 (Probs with FOR XML EXPLICIT)

6. problem using component with asp page -- result of function not returned, instead original value returned

7. Trying to append a simple XML document as a node in an XML document

8. Replace Function returns Nothing instead of Zero-length string

9. Using XML file instead INI for user and app setting

10. return recordset in XML format

11. Problem using VB to retrieve ASP/XML using ADO recordset

12. Using return instead of Tab in VB??

 

 
Powered by phpBB® Forum Software