zoukankan      html  css  js  c++  java
  • 通过asp.net 生成xml文件

    做项目的时候ext需要xml数据,顺手就用asp.net 导了个,如下:     

    private   void   Page_Load(object   sender,   System.EventArgs   e)  
      {  
      SqlConnection   sc=new   SqlConnection("server=localhost;database=northwind;user   id=sa;password=");  
      sc.Open();  
      SqlCommand   scd=new   SqlCommand("SELECT   ProductID,   ProductName   FROM   Products   WHERE   CategoryID   =   1   ORDER   BY   ProductID",sc);  
      SqlDataAdapter   sda=new   SqlDataAdapter(scd);  
      DataSet   ds=new   DataSet();  
      sda.Fill(ds,"product");  
      sc.Close();  
       
      MemoryStream   ms=new   MemoryStream();  
      ds.WriteXml(ms,XmlWriteMode.IgnoreSchema);  
       
      ms.Position=0;  
      StreamReader   sr=new   StreamReader(ms);  
      Page.Response.Write(sr.ReadToEnd());  
      sr.Close();  
      }
  • 相关阅读:
    3、UML中的类图及类图之间的关系
    2、GoF的23种设计模式
    1、软件设计模式概念
    枚举
    泛型
    MySQL
    蚁群算法MATLAB解VRP问题
    蚁群算法MATLAB解TSP问题
    模拟退火解TSP问题MATLAB代码
    模拟退火学习
  • 原文地址:https://www.cnblogs.com/jicheng1014/p/1129382.html
Copyright © 2011-2022 走看看