私が使用している (XML Auto の場合、SQL サーバーからすべてのテーブル データを取得します。XSLT を使用して、サーバーから XML のスタイルを設定します。SQL サーバーから返された xml をフォルダー内の xml ファイルに保存したい (問題のあるフォルダーと xml が作成されました)ファイル)
protected void Page_Load(object sender, EventArgs e)
{
string strConnenction = System.Configuration.ConfigurationManager.
ConnectionStrings["Connectionstring0034"].ConnectionString;
XmlDocument xd = new XmlDocument();
XPathNavigator xpathnav = xd.CreateNavigator();
using (SqlConnection conn = new SqlConnection(strConnenction))
{
conn.Open();
SqlCommand command = new SqlCommand(
"select * from Employees as products for XML AUTO, ELEMENTS", conn);
using (XmlWriter xw = xpathnav.PrependChild())
{
xw.WriteStartElement("products");
using (XmlReader xr = command.ExecuteXmlReader())
{
xw.WriteNode(xr, true);
}
xw.WriteEndElement();
}
}
XmlProducts.XPathNavigator = xpathnav;
}
}
助けてくれてどうもありがとう