我有這個xml文件。我試圖獲取特定servername屬性的所有dbistance。 因爲我想添加在列表框級聯 的結果,這樣的默認各dbistance信息組 - DBCATALOG - 用戶名 - 密碼 - 1433 討好我......開始LINQ恨:)查詢linq到xml
<?xml version="1.0" encoding="utf-8" ?>
<root>
<server servername="SRV01">
<dbistance>
<istancename>DEFAULT</istancename>
<catalog>DBCATALOG01</catalog>
<username>USERNAME</username>
<password>PASSWORD</password>
<port>1433</port>
</dbistance>
<dbistance>
<istancename>DEFAULT</istancename>
<catalog>DBCATALOG02</catalog>
<username>USERNAME</username>
<password>PASSWORD</password>
<port>1433</port>
</dbistance>
</server>
<server servername="SRV02">
<dbistance>
<istancename>DEFAULT</istancename>
<catalog>DBCATALOG01</catalog>
<username>USERNAME</username>
<password>PASSWORD</password>
<port>1433</port>
</dbistance>
</server>
</root>
+1非標準方法 –