1,
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.readyxmlreader (), xmlreadmode.fragment; sqlconn.close (); SQLCONN = NULL;
DS.DataSetName = "Treenodes"; ds.writeXml (Response.outputStream);
}