Sql Server multiple XML result sets to ADO.NET

  • Thread starter Thread starter randall g
  • Start date Start date
R

randall g

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?
 
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
 
Back
Top