468,285 Members | 1,571 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,285 developers. It's quick & easy.

Sql Server multiple XML result sets to ADO.NET

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?


Nov 18 '05 #1
1 2010
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" <ra******@nospam.com> wrote in message
news:hu********************************@4ax.com...
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?

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Graham | last post: by
2 posts views Thread by Darko Jovisic | last post: by
5 posts views Thread by Stanley Sinclair | last post: by
3 posts views Thread by =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.