生成xml时出现错误 [英] get an error while generating xml

查看:149
本文介绍了生成xml时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码从数据集中生成xml.但写完此后,我收到一条错误消息.有人可以帮我解决这个问题吗?


I am using this code to generate a xml from a dataset. but after writing this i get an error message. can anyone help me to solve this ?


XmlTextWriter xmlWriter = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);




错误消息:
The name ''Encoding'' does not exist in the current context




error message:
The name ''Encoding'' does not exist in the current context

推荐答案

尝试使用System.Text.Encoding.UTF8
检查是否存在对System.Text
Try using System.Text.Encoding.UTF8
Check if reference exists to System.Text


的引用添加以下名称空间:

Add the following namespace:

using System.Text;


,您也可以将其放入您的中. aspx.cs文件.

You can also put this into your .aspx.cs file.

using System.Text;



我不知道为什么默认情况下所有项目模板都不包含此(和System.IO).在我创建的几乎每个项目中,我都需要.



I don''t know why none of the project templates include this (and System.IO) by default yet. I need both in practically every project I create.


这篇关于生成xml时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆