Overview
An error will be encountered when a sales document containing improper syntax is opened. Use the Quick Report on the following page to pull all document notes in order to find syntax errors.
Error:
Quick Report:
select Notes, * from spv3SalesDocument where CHARINDEX('SalesPad_Notes', cast(notes as varchar(max)))>0
<br />
foreach (System.Data.DataRow dr in dataRow.Table.Rows) { string allNotes = dr["Notes"].ToString();<br />
string preXml =<br />
(allNotes.IndexOf("<SalesPad_Notes>") == -1 ? allNotes :<br />
allNotes.Substring(0, allNotes.IndexOf("<SalesPad_Notes>"))).TrimEnd('\r','\n', ' ');<br />
string postXml = (allNotes.IndexOf("</SalesPad_Notes>")<br />
== -1 ? "" :<br />
allNotes.Substring(allNotes.IndexOf("</SalesPad_Notes>")<br />
+("</SalesPad_Notes>").Length)).TrimEnd('\r', '\n', ' ');<br />
string xml = allNotes.Substring(allNotes.IndexOf("<SalesPad_Notes>")); xml = xml.Substring(0,xml.IndexOf("</SalesPad_Notes>") + ("</SalesPad_Notes>").Length);<br />
try {<br />
System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.LoadXml(xml);<br />
//System.Windows.Forms.MessageBox.Show(dr["Sales_Doc_Num"].ToString()<br />
+"\r\n\r\n" + xml);<br />
}<br />
catch (System.Exception ex)<br />
{<br />
System.Windows.Forms.MessageBox.Show(dr["Sales_Doc_Num"].ToString() +"\r\n\r\n"<br />
+ ex.Message + "\r\n\r\n" + allNotes);<br />
}<br />
}<br />