public void GetMusicFlashList(int id) { MgCms.BLL.Mg_MusicInfoBLL MusicInfoBLL = new MgCms.BLL.Mg_MusicInfoBLL(); StringBuilder strHtml = new StringBuilder(); DataSet ds = MusicInfoBLL.GetList(string.Format(" BagID = '{0}' and Status='1' order by Sort desc ", id)); if (ds.Tables[0].Rows.Count > 0) { strHtml.AppendLine("<?xml version=\"1.0\" encoding=\"gb2312\"?>"); strHtml.AppendLine("<list>"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { strHtml.AppendLine("<music> "); strHtml.AppendFormat("<name>{0}</name> ", ds.Tables[0].Rows[i]["MusicTitle"]); strHtml.AppendFormat("<url>{0}</url>", ds.Tables[0].Rows[i]["MusicUrl"]); strHtml.AppendFormat("</music>"); } strHtml.AppendLine("</list>"); string filename = Server.MapPath("/xml/list.xml"); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filename); xmlDoc.RemoveAll(); xmlDoc.InnerXml = strHtml.ToString(); xmlDoc.Save(filename); } }
浙公网安备 33010602011771号