因此,我正在使用 aXmlWriter
和 a构建一些 XML,DataSet
但是当需要循环遍历其中的每个DataRow
时,DataSet
我无法弄清楚如何像“userid”这样的引用以及从存储过程中返回的引用。在页面代码中,我看到他们正在Eval("userid")
使用相同的存储过程或其他方式执行此操作,但我现在在 ASHX 中使用它......请参阅“这里发生了什么??” 在下面的代码中......
DataSet getData;
getData = SqlHelper.ExecuteDataset(ConfigurationManager.ConnectionStrings["connstr"].ConnectionString, CommandType.StoredProcedure, "Course_NewReportGet_Get_Sav", objPAra)
//COUNT NUMBER OF RESULTS FOR COUNT ATTRIBUTE (must add!)
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = (" ");
using(XmlWriter writer = XmlWriter.Create("data.xml", settings))
{
writer.WriteStartElement("changes");
writer.WriteAttributeString("clientname", foundCompany.CompanyName);
writer.WriteAttributeString("clientid", foundCompany.Abbreviation);
//writer... INSERT COUNT ATTRIBUTE
foreach(DataRow dr in getData.Tables)
{
writer.WriteStartElement("change");
writer.WriteStartElement("user");
writer.WriteAttributeString("userid", dr... WHAT GOES HERE??;
}
writer.WriteEndElement();
}