一聚教程网:一个值得你收藏的教程网站

热门教程

XSLT / XML / C

时间:2022-07-02 11:47:27 编辑:袖梨 来源:一聚教程网

XSLT / XML / C# (转)

这个例程展示了如何将xslt 应用于从数据库中读出的xml格式数据上. 例程完全使用C#语言编写:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Xsl;
public class XsltTransform
    {
        public static void Transform()
        {
       SqlConnection nwindConn = new SqlConnection("Data
       Source=INMUMIS123;database=northwind;uid=sa;pwd=;");
       nwindConn.Open();
       DataSet custDS = new DataSet("CustomerDataSet");
       SqlDataAdapter custDA = new SqlDataAdapter("SELECT * FROM Customers",
       nwindConn);
       custDA.Fill(custDS, "Customers");
       SqlDataAdapter ordersDA = new SqlDataAdapter("SELECT * FROM Orders",
       nwindConn);
       ordersDA.Fill(custDS, "Orders");
       nwindConn.Close();
       custDS.Relations.Add("CustOrders",
       custDS.Tables["Customers"].Columns["CustomerID"],

热门栏目