By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,152 Members | 1,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,152 IT Pros & Developers. It's quick & easy.

Sql Server multiple XML result sets to ADO.NET

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.