Tôi có mã này:
XElement EcnAdminConf = new XElement("Type",
new XElement("Connections",
new XElement("Conn"),
// Conn.SetAttributeValue("Server", comboBox1.Text);
// Conn.SetAttributeValue("DataBase", comboBox2.Text))),
new XElement("UDLFiles")));
// Conn.
Làm cách nào để thêm thuộc tính vào Conn? Tôi muốn thêm các thuộc tính tôi đã đánh dấu là nhận xét, nhưng nếu tôi cố gắng đặt thuộc tính Connsau khi xác định EcnAdminConf, chúng không hiển thị.
Tôi muốn đặt chúng bằng cách nào đó để XML trông như thế này:
<Type>
<Connections>
<Conn ServerName="FAXSERVER\SQLEXPRESS" DataBase="SPM_483000" />
<Conn ServerName="FAXSERVER\SQLEXPRESS" DataBase="SPM_483000" />
</Connections>
<UDLFiles />
</Type>