如何读取xml文件? [英] How can i Read xml file?

查看:64
本文介绍了如何读取xml文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要读取XML文件来获取连接字符串,我正在使用ASP.NET
如何阅读?

在此先感谢

i need to read XML file to get connection string, I am using ASP.NET
How to read it ?

Thanks in advance

推荐答案

您是从Web.Config文件中获取意思吗?

然后检查一下: http://msdn.microsoft.com/en-us/library/ms178411.aspx [ ^ ]
You mean from Web.Config file right?

Check out this then : http://msdn.microsoft.com/en-us/library/ms178411.aspx[^]


感谢Q n,这是ans
Thanks for the Q n here is the ans
<connectionStrings>
   <add name="Con1" connectionString="connectionstring"/>
 </connectionStrings>





System.Configuration.ConfigurationManager.ConnectionStrings["Con1"].ConnectionString.ToString();


如果您要读取的配置不是从web.config中而是从您自己的一些xml文件中读取的,那么下面的文章为您提供了您正在寻找的信息:
以最简单的方式在C#中使用XML [
If you are looking to read some configurations not from web.config but from some of the xml files of your own, then the following article provides you the information you are looking for:
Using XML in C# in the simplest way[^]

Hope this will help you


这篇关于如何读取xml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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