【发布时间】:2011-04-19 06:11:25
【问题描述】:
我在 2007 年启用浏览器的 infopath 表单的字段更改事件中有此代码 -
try
{
XmlDocument outputFile = new XmlDocument();
FileQueryConnection con = (FileQueryConnection)DataConnections["connection1"];
con.FileLocation = @"http://server_name/_vti_bin/owssvr.dll"
+ "?Cmd=Display&List={List_ID}"
+ "&XMLDATA=TRUE&View={View_ID}&Query=*"
+ "&FilterField1=Country_x0020_Name&FilterValue1="
+ country.Replace("&","%26");
outputFile.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><outputRoot></outputRoot>");
XmlNamespaceManager outputFileNamespaceManager = new XmlNamespaceManager(outputFile.NameTable);
// XmlDocument output file created above.
XPathNavigator outputFileNavigator = outputFile.CreateNavigator();
XPathNavigator outputRootNavigator =
outputFileNavigator.SelectSingleNode("/outputRoot",outputFileNamespaceManager);
con.Execute(outputRootNavigator);
File.AppendAllText(@"E:\log.txt", outputRootNavigator.ToString());
}
catch (Exception exp)
{
File.AppendAllText(@"E:\exp.txt", exp.ToString());
}
我得到了这个异常 -
System.Net.WebException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.at Microsoft.Office.InfoPath.Internal.MomExceptionHelper.ExecuteDataConnectionAction(OMCall d) at Microsoft.Office.InfoPath.Internal.FileQueryConnectionHost.Execute(XPathNavigator output) at cascadeTemplate.FormCode.field1_Changed(Object sender, XmlEventArgs e)
为什么会抛出这样的异常?我的代码中是否缺少某些内容?
感谢您的帮助!
【问题讨论】:
标签: c# asp.net xml sharepoint infopath