Use DataSet to populate Tree

xiaoxiao2021-03-06  94

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);

}

转载请注明原文地址:https://www.9cbs.com/read-126019.html

New Post(0)