binding to string of xml

J

jason

In vs.net 2005, is there any way to bind a datalist to a method
returning an xml string like this one?

public static string Gogetit(string name)
{
string conn = "Data
Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\xx.mdf;Integrated
Security=True;User Instance=True";
using (SqlConnection connection = new SqlConnection(conn))
{
connection.Open();
SqlCommand cmd = new SqlCommand("select * from book2 for
xml path", connection);
cmd.CommandType = CommandType.Text;
XmlReader xr = cmd.ExecuteXmlReader();
xr.MoveToContent();
return(xr.ReadOuterXml());

When I attempt, the datalist items do not show up.

Also, can anybody tell me why the above might be only returning the
first row?

And, if the above was encapsulated in a webservice, would there be any
way to bind the datalist to it? does it even make sense to ask that?
Why would anybody even do that?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,592
Members
45,103
Latest member
VinaykumarnNevatia
Top