Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intermittent Error: “The form cannot run the specified query.”

24 views
Skip to first unread message

Michael S

unread,
May 7, 2009, 2:52:03 AM5/7/09
to
Product: InfoPath 2007 browser-enabled form (SharePoint 2007 enterprise
edition)

We found a great article that explained how to filter against a SharePoint
list with minimal code.
http://edgedev.blogspot.com/2008/09/bending-infopath-and-sharepoint-to-your.html
The code in the link is in C#, but we changed it to VB.

The form is working great over the InfoPath client, but once we published
the form to SharePoint and started rendering it in the browser we started
receiving intermittent errors and the data not being posted back (about 50%
percent of the time).

After adding a line in the code to display the error, it appears the code is
erroring out when it attempts to execute the query before it actually post
data back to a SharePoint list then switch views.

ERROR: “The form cannot run the specified query.”

Has anyone seen this error before or can take a quick look at the code below
to see if there is an apparent problem I’m missing?
Any advice is very much appreciated. I’m a SharePoint admin and very new to
developing, so I really appreciate your time. I’d be happy to answer any of
your SharePoint system engineering questions. 

Troubleshooting/research:
Converted data connections to data connection libraries
Double checked permissions (occurring with multiple user accounts)
Add line to clear the variable
There is no apparent pattern as to when the error will occur

Code:

Public Sub BtnSubmit_Clicked(ByVal sender As Object, ByVal e As
ClickedEventArgs)
Dim ns As XmlNamespaceManager

Dim dsListData As DataSource
Dim xnListData As XPathNavigator
Dim xiListData As XPathNodeIterator
Dim dsCAML As DataSource
Dim xnCAML As XPathNavigator
Dim wsSubmit As WebServiceConnection
Dim strOriginalLocation As String

Try

ns = Me.NamespaceManager

dsListData = Me.MainDataSource
xnListData = dsListData.CreateNavigator()
xiListData = xnListData.Select("/my:myFields", ns)

dsCAML = Me.DataSources("Staff_CAML")

xnCAML = dsCAML.CreateNavigator()

wsSubmit = CType(Me.DataConnections("PostChanges"),
WebServiceConnection)


'******************************************************************************
'Pull data for table on View_2 based on chapter code

'*******************************************************************************
'Get reference to the dataconnection
Dim dc As FileQueryConnection
dc = Me.DataConnections("Staff_READ_2")
strOriginalLocation = dc.FileLocation

' next, we append the Column to filter by and value to
filter by to the file location
dc.FileLocation = dc.FileLocation &
"&FilterField1=Code&FilterValue1=" &
xiListData.Current.SelectSingleNode("/my:myFields/my:Code", ns).Value.ToString
'finally, we execute the data connection to return the results
dc.Execute()


'*******************************************************************************************
'Check if there is already a row for this chapter code
'If rows exists then the chapter exec had already added his
data, So we need not add it again
'If no rows exists then this is the first time the chapter
exec is filling in form
'and we add the chapter exec details before moving to next
page

'********************************************************************************************

If Not
Me.DataSources("Staff_READ_2").CreateNavigator().SelectSingleNode("/xml/rs:data", ns).InnerXml.Contains("row") Then


'*****************************************************************
' set CAML data and submit to PostChanges

'********************************************************************

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='ID']", ns).SetValue("1")

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='Code']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:Code",
ns).Value.ToString)

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='FName']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:FName",
ns).Value)

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='LName']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:LName",
ns).Value)

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='Title']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:Title",
ns).Value)

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='Phone']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:Phone",
ns).Value)

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='Email']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:Email",
ns).Value)

xnCAML.SelectSingleNode("/Batch/Method/Field[@Name='Username']",
ns).SetValue(xiListData.Current.SelectSingleNode("/my:myFields/my:Username",
ns).Value)

' Submit the updates for the current row.
wsSubmit.Execute()
End If

'refresh the table on page 2 after adding chapter exec details
dc.Execute()


'******************************************************************************
' Clear all input fields except Chaptercode

'*****************************************************************************
xiListData.Current.SelectSingleNode("/my:myFields/my:FName",
ns).SetValue("")
xiListData.Current.SelectSingleNode("/my:myFields/my:LName",
ns).SetValue("")
xiListData.Current.SelectSingleNode("/my:myFields/my:Title",
ns).SetValue("")
xiListData.Current.SelectSingleNode("/my:myFields/my:Phone",
ns).SetValue("")
xiListData.Current.SelectSingleNode("/my:myFields/my:Email",
ns).SetValue("")

xiListData.Current.SelectSingleNode("/my:myFields/my:Username",
ns).SetValue("")

'reset the filelocation to original location
dc.FileLocation = strOriginalLocation


'******************************************************************************
'Switch to next view

'*******************************************************************************
Me.ViewInfos.SwitchView("View_2")

Catch Ex As Exception
xiListData.Current.SelectSingleNode("/my:myFields/my:Title",
ns).SetValue(Ex.Message)
Me.NotifyHost(Ex.Message)

Finally
If Not dsListData Is Nothing Then
dsListData = Nothing
End If
If Not xnListData Is Nothing Then
xnListData = Nothing
End If
If Not xiListData Is Nothing Then
xiListData = Nothing
End If
If Not dsCAML Is Nothing Then
dsCAML = Nothing
End If
If Not xnCAML Is Nothing Then
xnCAML = Nothing
End If
If Not wsSubmit Is Nothing Then
wsSubmit = Nothing
End If
End Try
End Sub

mhoffm...@gmail.com

unread,
Oct 9, 2015, 4:30:19 PM10/9/15
to
Did you ever get a response on this? If not on here, on other forums? We seem to be having the same issue, but I'm not even close to a developer. I would like someone to give some guidance as to where to look -- as I'm sure you were at this time too...
0 new messages