Web Service to populate InfoPath repeating list - InfoPath Dev
in

InfoPath Dev

Web Service to populate InfoPath repeating list

Last post 05-02-2007 08:49 AM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-22-2007 10:58 AM

    Web Service to populate InfoPath repeating list

    I have a web service that executes a SQL stored procedure. The stored procedure executes and fills a dataset. How do I get the dataset into an InfoPath repeating list ? Here is the code I have now.

    <WebMethod(Description:="Retrieves the list of roles for a given userID.")> _
    Public Function GetUserRoles(ByVal sUserID As String) As XmlNode
    Dim oConnection As New SqlConnection
    Dim oDataset As New DataSet

    oConnection.ConnectionString = g_sCONN_STRING

    Try
    Dim oCommand As New SqlCommand("dbo.usp_MOCSVCS_selUserRoles", oConnection)
    Dim parameter As SqlParameter
    Dim oDataAdatpter As SqlDataAdapter

    oCommand.CommandType = CommandType.StoredProcedure
    oCommand.Connection.Open()
    'Add parameters to oCommand object
    parameter = oCommand.Parameters.Add("@sUserID", SqlDbType.NChar)
    'Set parameter value
    oCommand.Parameters("@sUserID").Value = sUserID

    ' Create the DataAdapter & DataSet
    oDataAdatpter = New SqlDataAdapter(oCommand)

    ' Fill the DataSet using default values for DataTable names, etc
    oDataAdatpter.Fill(oDataset)

    Catch ex As Exception
    'Return ex.Message
    Finally
    oConnection.Close()
    End Try

    Return DataSetToXmlNode(oDataset)
  • 05-02-2007 08:49 AM In reply to

    Re: Web Service to populate InfoPath repeating list

    Hi dgibson,

    This shouldn't be too hard to do in code behind the InfoPath form. You will need to inspect the XML that is returned from the web service, wrap it into an object, and then fill your secondary data source with it. I have some code samples to look at if you need any more help.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.