Oops, looks like I pasted the same line twice!
That should have been:
<sb.AppendFormat("<Field Name=''Title''>{0}</Field>", ProjectID>
and
<sb.AppendFormat("<Field Name=''Project_Title''>{0}</Field>", ProjectID>
Sorry for the confusion!
Here's the code I'm using.
Public Sub AddMethodNode(ByVal id As Integer, ByVal ProjectID As Integer, ByVal pdate As Date, ByVal pcapacity As Integer)
Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder()
sb.AppendFormat("", id.ToString())
sb.AppendFormat("{0}", ProjectID)
'sb.AppendFormat("{0}", pdate)
'sb.AppendFormat("{0}", pcapacity)
sb.AppendFormat("")
Dim methodXml As XmlDocument = New XmlDocument()
methodXml.LoadXml(sb.ToString())
Dim secDSNav As XPathNavigator = DataSources("CustomListCAML").CreateNavigator()
Dim batchNav As XPathNavigator = secDSNav.SelectSingleNode("/Batch", NamespaceManager)
batchNav.AppendChild(methodXml.DocumentElement.CreateNavigator())
End Sub
Public Sub CTRL47_28_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
' Delete all Method nodes from the CAML Batch XML
Dim ns As XmlNamespaceManager = Me.NamespaceManager
Dim secDSNav As XPathNavigator = DataSources("CustomListCAML").CreateNavigator()
Dim iter As XPathNodeIterator = secDSNav.Select("/Batch/Method")
Dim methodNodesCount As Integer = iter.Count
Dim firstMethodNav As XPathNavigator = _
secDSNav.SelectSingleNode("/Batch/Method[1]", _
NamespaceManager)
Dim lastMethodNav As XPathNavigator = _
secDSNav.SelectSingleNode("/Batch/Method[" & _
methodNodesCount.ToString() & "]", _
NamespaceManager)
firstMethodNav.DeleteRange(lastMethodNav)
' Retrieve the rows of the repeating table
Dim root As XPathNavigator = MainDataSource.CreateNavigator()
Dim rows As XPathNodeIterator = root.Select( _
"/my:myFields/my:Projected_Repeating_Table/my:Table", NamespaceManager)
' Loop through the rows of the repeating table
' and construct the CAML Batch XML
Dim counter As Integer = 1
While rows.MoveNext()
' Retrieve the title
Dim ProjectID As String = rows.Current.SelectSingleNode( _
"/my:myFields/my:Projected_Repeating_Table/my:Table/my:ProjectID", NamespaceManager).Value
Dim pdate As String = rows.Current.SelectSingleNode( _
"/my:myFields/my:Projected_Repeating_Table/my:Table/my:Date", NamespaceManager).Value
Dim pCapacity As String = rows.Current.SelectSingleNode( _
"/my:myFields/my:Projected_Repeating_Table/my:Table/my:Capacity", NamespaceManager).Value
' Add an item to the CAML Batch XML
AddMethodNode(counter, ProjectID, pdate, pCapacity)
' Increment the counter
counter = counter + 1
End While
' Submit the rows to the Lists web service to update the custom list
DataConnections("CustomListItemsSubmit").Execute()
End Sub