我是说select之后,存进一个XmlReader 中。
通过Read()可以得到这个XML的内容。把这个内容发送过去。
进程2如何把接到的这个XML放到一个XmlReader中?

解决方案 »

  1.   

    消息队列可以保存对象的
    所以...使用DataSet吧,用不着那么麻烦(-:
      

  2.   

    发送消息using System;
    using System.Messaging;public class MQSend
    {
        public static void Main(String[] args)
        {
            string appName = Environment.GetCommandLineArgs()[0];        if(args.Length != 2) {
                Console.WriteLine("Usage: " + appName +" <queue> <message>");
            } else {
                string mqPath = ".\\" + args[0];
                if(!MessageQueue.Exists(mqPath)) {
                    MessageQueue.Create(mqPath);
                }            MessageQueue mq = new MessageQueue(mqPath);
                mq.Send(args[1]);
            }        Console.WriteLine();
            Console.WriteLine("Press Enter to continue...");
            Console.ReadLine();
        }
    }
    接收消息using System;
    using System.Messaging;
    using System.IO;
    using System.Runtime.Serialization;public class MQReceive {
        public static void Main(String[] args)
        {
            string appName = Environment.GetCommandLineArgs()[0];        if ( args.Length != 1 ) {
                Console.WriteLine("Usage: {0} <queue>", appName);
            } else {
                string mqPath = ".\\" + args[0];            if ( !MessageQueue.Exists(mqPath) ) {
                    Console.WriteLine("The queue '{0}' does not exist!", mqPath);
                    return;
                }            MessageQueue mq = new MessageQueue(mqPath);
                ((XmlMessageFormatter)mq.Formatter).TargetTypeNames = new string[]{"System.String,mscorlib"};            try {
                    Message m = mq.Receive(new TimeSpan(0,0,3));
                    Console.WriteLine("Message: {0}", (string)m.Body);
                }
                catch ( MessageQueueException ) {
                    Console.WriteLine("There are no messages in the queue");
                    return;
                }
                catch ( InvalidOperationException ) {
                    Console.WriteLine("The message removed from the queue is not a string");
                    return;
                }
            }        Console.WriteLine();
            Console.WriteLine("Press Enter to continue...");
            Console.ReadLine();
        }
    }
      

  3.   

    我也觉得不必那么麻烦,dataset载传输的时候,自动会转化成xml格式的。