如何获取VB.NET中app.config中提到的标签defaultDatabase [英] How do I get the tag defaultDatabase mentioned in app.config in VB.NET

查看:131
本文介绍了如何获取VB.NET中app.config中提到的标签defaultDatabase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<small></small>

我的app.config中有以下代码



I have following code in my app.config

dataconfiguration defaultdatabase="ForeTVSQL"



/ dataconfiguration




/dataconfiguration

connectionstrings
add name="ForeTVSQL" connectionstring="Password=msafocus;Persist Security Info=False;User ID=sa;Initial Catalog=MainSource_Version;Data Source=130.11.55.16\sql2012;Connect Timeout=180;"
		  providerName="System.Data.SqlClient" />



/ add

/ connectionstrings





我想在运行时获取defaultDatabase。我怎么才能得到它?

请帮忙!!



提前致谢!

Radhika


/add
/connectionstrings


I want to get defaultDatabase at runtime. How can I get it?
Please help!!

Thanks in advance!
Radhika

推荐答案

在连接字符串中
<dataConfiguration defaultDatabase="YourDatabase" />


如果我正确理解了这个问题,你可以使用 AppSettings [ ^ ]以读取配置。
If I understood the question correctly, you can use AppSettings[^] to read the configuration.


这篇关于如何获取VB.NET中app.config中提到的标签defaultDatabase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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