问题:
infopath报一下错误
validation found non-data type errors
架构验证过程发现非数据类型错误
原因:
重复表字段在后台代码里要一一对应,否则报错。
错误代码:
//Remove 1st row. It's empty by default
XPathNavigator FirstRowNode = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:e301/my:e301list/my:e301item[1]", NamespaceManager);
FirstRowNode.DeleteSelf(); XPathNavigator e301list = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:e301/my:e301list", NamespaceManager);
string myNamespace = NamespaceManager.LookupNamespace("my");
using (XmlWriter writer = e301list.AppendChild())
{
writer.WriteStartElement("e301item", myNamespace);
writer.WriteElementString("SAPNo", myNamespace, Excel_SAP_NO);
writer.WriteElementString("cost", myNamespace, Excel_Cost.ToString());
writer.WriteElementString("Description", myNamespace, Excel_Description);
writer.WriteElementString("Quantity", myNamespace, Excel_Quantity);
writer.WriteElementString("RequiredDate", myNamespace, Excel_Required_date.Year + "-" + Excel_Required_date.Month + "-" + Excel_Required_date.Day);
writer.WriteElementString("StorageLocation", myNamespace, Excel_Storage_location);
writer.WriteElementString("Remark", myNamespace, Excel_Remark);
writer.WriteEndElement();
writer.Close();
}