VictorStone

导航

 
        static public DataSet DataSetFromString(string s)
        {
            if (string.IsNullOrEmpty(s)) { return null; }

            byte[] bytes = Encoding.UTF8.GetBytes(s);

            Stream inStream = null;
            DataSet ds = new DataSet();
            try
            {
                inStream = new MemoryStream(bytes); 
                ds.ReadXml(inStream);
            }
            finally
            {
                inStream.Close();
            }
            return ds;
        }

        static public string GetStringFromTable(DataSet ds)
        {
            XmlDataDocument doc = new XmlDataDocument(ds);
            return ds.GetXml();;
        }

 

posted on 2013-08-21 14:39  VictorStone  阅读(1006)  评论(0编辑  收藏  举报