How can I bind a XML column in SQL 2005 to a TreeView control
Normally, we can bind a xml file to a TreeView control (just like Part 1), but now I have store XML data in a XML field in SQL 2005,
I may retrieve the data using Part 2, but I don't know how to bind the XML to a TreeView control, could you help me? thanks!
//----------Part 1--------------
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1">
</asp:TreeView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Authors.xml">
</asp:XmlDataSource>
</div>
</form>
</body>
//----------Part 1--------------
//----------Part 2--------------
SqlConnection conn = new SqlConnection("context connection=true");
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT xCol.query('//section') FROM docs where UserId=3";
SqlDataReader r = cmd.ExecuteReader();
r.Read();
SqlXml xml = r.GetSqlXml(0);
//----------Part 2--------------

