看看国外的一个操作XML的东西。很不错。一、System.Data.XmlClient - XmlCommand

- 中国WEB开发者网络 (http://www.webasp.net)
-- 技术教程 (http://www.webasp.net/article/)
--- 看看国外的一个操作XML的东西。很不错。一、System.Data.XmlClient - XmlCommand (http://www.webasp.net/article/5/4231.htm)
-- 作者:未知
-- 发布日期: 2003-07-12
using System;
using System.ComponentModel;
using System.Data;
using System.Xml;

namespace System.Data.XmlClient
{

  public class XmlCommand : Component, IDbCommand, ICloneable
    {
    // Constructors
    public XmlCommand()
        {
        }

    public XmlCommand(string sCommand)
    {
      _commandText = sCommand;
      _connection = null;
    }

    public XmlCommand(string sCommand, XmlConnection conn)
    {
      _commandText = sCommand;
      _connection = conn;
    }

    ////////////////////
    // IDbCommand
    ////////////////////

    // Public Properties
    public string CommandText
    {
      get { return _commandText;  }
      set { _commandText = value; }
    }

    public int CommandTimeout
    {
      get { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
      set { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
    }

    public CommandType CommandType
    {
      get { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
      set { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
    }

    public IDbConnection Connection
    {
      get { return _connection;  }
      set { _connection = (XmlConnection) value; }
    }

    public IDataParameterCollection Parameters
    {
      get { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
    }

    public IDbTransaction Transaction
    {
      get { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
      set { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
    }

    public UpdateRowSource UpdatedRowSource
    {
      get { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
      set { throw new InvalidOperationException("XmlClient Provider does not support this property"); }
    }

    // Public Methods
    public void Cancel()
    {
      throw new InvalidOperationException("XmlClient Provider does not support this function");
    }

    public IDbDataParameter CreateParameter()
    {
      throw new InvalidOperationException("XmlClient Provider does not support this function");
    }

    public int ExecuteNonQuery()
    {
      throw new InvalidOperationException("XmlClient Provider does not support this function");
    }

    public IDataReader ExecuteReader()
    {
      return null;
    }

    public IDataReader ExecuteReader(CommandBehavior behavior)
    {
      return null;
    }

    public object ExecuteScalar()
    {
      throw new InvalidOperationException("XmlClient Provider does not support this function");
    }

    public void Prepare()
    {
      //throw new InvalidOperationException("XmlClient Provider does not support this function");
    }

    ////////////////////
    // ICloneable
    ////////////////////
    public object Clone()
    {
      return null;
    }

    ////////////////////
    // Internal Data Members
    ////////////////////
    internal string _commandText = "";
    internal XmlConnection _connection = null;
     }
}

webasp.net