如何将数据库中数据源生成xml文件 sql server
2个回答
展开全部
List<Area> list = a.GetAllAreaById(id);
//将list集合序列化到流中
MemoryStream stream = new MemoryStream();
XmlSerializer s = new XmlSerializer(typeof(List<Area>));
s.Serialize(stream, list);
//将流转换成字节数组,再解码为字符串
string ss = System.Text.Encoding.UTF8.GetString(stream.ToArray());
XmlDocument dom = new XmlDocument();
dom.LoadXml(ss);
Response.ContentType = "text/xml";
Response.Charset = "utf-8";
HttpContext.Current.Response.Write(dom.OuterXml);
//将list集合序列化到流中
MemoryStream stream = new MemoryStream();
XmlSerializer s = new XmlSerializer(typeof(List<Area>));
s.Serialize(stream, list);
//将流转换成字节数组,再解码为字符串
string ss = System.Text.Encoding.UTF8.GetString(stream.ToArray());
XmlDocument dom = new XmlDocument();
dom.LoadXml(ss);
Response.ContentType = "text/xml";
Response.Charset = "utf-8";
HttpContext.Current.Response.Write(dom.OuterXml);
展开全部
xml --> sql server
http://community.csdn.net/Expert/topic/5041/5041228.xml?temp=.8233911
http://community.csdn.net/Expert/topic/5041/5041228.xml?temp=.8233911
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询