Sql Server multiple XML result sets to ADO.NET

Discussion in 'ASP .Net' started by randall g, Dec 29, 2003.

  1. randall g

    randall g Guest

    I have a stored procedure which returns multiple result sets, enclosing
    each in its own tag. This works in ADO but not ADO.NET, where an error
    is returned by ExecuteXmlReader:
    "Invalid command sent to ExecuteXmlReader. The command must return an
    Xml result."

    The procedure looks like this:

    create procedure xxx as
    select '<tag1>'
    select * .... for xml auto
    select '</tag1>'
    select '<tag2>'
    select * .... for xml auto
    select '</tag2>'
    select '<tag3>'
    select * .... for xml auto
    select '</tag3>'
    return
    go

    It is the "select 'literal'" statements that cause the problem, however
    this works perfectly well in ADO.

    How can I control the XML tagging for multiple result sets, in ADO.NET?
    randall g, Dec 29, 2003
    #1
    1. Advertising

  2. randall g

    Iain Guest

    I think you probably need to use for xml explicit which seems to be the way
    in which more complex xml is best handled.

    Iain
    "randall g" <> wrote in message
    news:...
    > I have a stored procedure which returns multiple result sets, enclosing
    > each in its own tag. This works in ADO but not ADO.NET, where an error
    > is returned by ExecuteXmlReader:
    > "Invalid command sent to ExecuteXmlReader. The command must return an
    > Xml result."
    >
    > The procedure looks like this:
    >
    > create procedure xxx as
    > select '<tag1>'
    > select * .... for xml auto
    > select '</tag1>'
    > select '<tag2>'
    > select * .... for xml auto
    > select '</tag2>'
    > select '<tag3>'
    > select * .... for xml auto
    > select '</tag3>'
    > return
    > go
    >
    > It is the "select 'literal'" statements that cause the problem, however
    > this works perfectly well in ADO.
    >
    > How can I control the XML tagging for multiple result sets, in ADO.NET?
    >
    >
    >
    >
    Iain, Dec 29, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Rossney
    Replies:
    0
    Views:
    532
    Robert Rossney
    Feb 7, 2006
  2. Mike Kingscott

    Shaping data/multiple result sets - hmmm...

    Mike Kingscott, Aug 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    307
    Mike Kingscott
    Aug 27, 2003
  3. Mike
    Replies:
    1
    Views:
    707
    Alexey Smirnov
    Mar 15, 2007
  4. Michael C#

    DataAdapter and multiple result sets

    Michael C#, May 10, 2005, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    227
    Michael C#
    May 10, 2005
  5. Michael Tan
    Replies:
    32
    Views:
    930
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page