web.configファイルがあり、特定のキー名の接続文字列値を取得したい。
<connectionStrings>
<add name="abc" connectionString="Server=(local);Initial Catalog=abc;Integrated Security=SSPI;Max Pool Size=25" providerName="System.Data.SqlClient" />
<add name="cde" connectionString="Server=(local);Initial Catalog=cde; Integrated Security=SSPI;Max Pool Size=50" providerName="System.Data.SqlClient" />
</connectionStrings>
configurationManagerで接続文字列を取得できることはわかっていますが、XMLリーダーで取得したいと思います。現在使用しています
XDocument document = XDocument.Load(fullPath);
var connectionString = from c in document.Descendants(connectionStrings)
select c ;
両方の接続文字列を取得しています。しかし、特定の「abc」接続文字列を取得したい。手伝ってくれませんか。