2,categories.aspx.cs
private void Page_Load(object sender, System.EventArgs e)
{
string sql=@"select categoryname as Text,'products.aspx?catid='+ltrim(str(categoryid)) as TreeNodesrc
from categories as TreeNode for xml auto ,xmlData " ;
SqlConnection sqlConn=new SqlConnection("Server=dbm-1;Uid=sa;pwd=;DataBase=Northwind");
SqlCommand com=new SqlCommand (sql,sqlConn);
DataSet ds=new DataSet();
sqlConn .Open();
ds.ReadXml(com.ExecuteXmlReader(),XmlReadMode.Fragment );
sqlConn.Close();
sqlConn=null;
ds.DataSetName ="TREENODES";
ds.WriteXml(Response.OutputStream );
}
本文地址:http://com.8s8s.com/it/it44477.htm