Searching within a Data Connection - InfoPath Dev
in

InfoPath Dev

Searching within a Data Connection

Last post 04-12-2008 07:06 AM by Clay Fox. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-12-2008 05:09 AM

    • Cutejon
    • Not Ranked
      Male
    • Joined on 03-26-2008
    • Philippines
    • Posts 20

    Searching within a Data Connection

    Hi everyone,

    my scenario is this :

    1. data connection connects to a sharepoint list / document library.

    2. The results returned by the data connection must further be examined so that a subset of data will only be taken, which is based on conditions/parameters set by user.

    3. Code done in VBscript.

    is it possible to query the mentioned data connection?

    As I have seen in some posts, this can be done via ADOQueryConnection, which is only applicable to data connections using SQL database. Just plug in the SQL statement then viola, results are returned. (as stated in this help file: ms-help://MS.VSTACC.v80/MS.IPVSTA12.12.1033/IPVSTA12/html/4b06c377-52fc-ffeb-7b15-d5fb0e286da5.htm)

    '----------------------------Code in help file ----------------------------------------------------

       ' Get the Employees connection from the
       ' DataConnections collection.
       Dim myAdoQueryConnection As AdoQueryConnection = DirectCast(Me.DataConnections("Employees"), AdoQueryConnection)

       ' Get the employee's ID from the EmpID field in
       ' the main data source.
       Dim myNav As XPathNavigator = CreateNavigator().SelectSingleNode("/my:myFields/my:EmpID", NamespaceManager)
       Dim employeeID As String = myNav.InnerXml

       ' Change the SQL command for Employees connection to retrieve
       ' the record of the Employee's ID entered by the user.
       myAdoQueryConnection.Command = "select * from [Employees] where [EmployeeID] = " + employeeID

       ' Execute the updated command against the data connection to
       ' refresh the data.
        myAdoQueryConnection.Execute()
    '----------------------------End of Code------------------------------------------------------------------- 

     But my backend data store is sharepoint. What code / class do i need to use to do this?

    If yes, can you also have these results sorted the way you wanted? (coz this will speed up my data manipulation)

    If you have/can share these codes its much appreciated!

    Jon

  • 04-12-2008 07:06 AM In reply to

    Re: Searching within a Data Connection

    I believe you can use a static query with SharePoint but often a dynamic query is what you are looking for.

    I use web services on SQL to be able to dynamicly query anything I want and sort without needing code.  I do not think there is a way to really have dynamic queries with SharePoint, that is one of the limitations, besides no relational data capability and performance issues for scalability.

    There may be some code for this out there somewhere,  I know you can load all of the data in and then transfer it into a node in your main schema and sort and filter it there to prep it for your dropdown but that is a pan but one option.

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.