如何在ASP.Net和Xml中创建连接字符串? [英] How to create connection-string in ASP.Net and Xml?
本文介绍了如何在ASP.Net和Xml中创建连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要生成xml文件作为连接字符串(ConnactionString.xml),该怎么办?
I need to generate xml file as connection string(ConnactionString.xml), How can I do it?
推荐答案
int count = System.Configuration.ConfigurationManager.ConnectionStrings.Count;
for (int i = 0; i <= count; i++)
{
string conn = System.Configuration.ConfigurationManager.ConnectionStrings[i].ToString();
}
然后您可以使用Xdocument
在for循环中创建元素,用于xml文件,然后保存xml!
and you can use Xdocument
to make elements in for loop, for xml file, and then save the xml!
这篇关于如何在ASP.Net和Xml中创建连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文