Form won't return data from a sql stored procedure - InfoPath Dev
in

InfoPath Dev

Form won't return data from a sql stored procedure

Last post 01-18-2007 10:05 AM by Tome. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-25-2006 10:52 AM

    Form won't return data from a sql stored procedure

    Hello --

    I'm trying to do something very simple. All I want is a button to run a stored procedure and return the data to the form and I get an error every time. Below is the code I'm using and the error I get. Any ideas? FYI - I have applied the Office 2003 service pack 2 that says is supposed to get rid of this error.
    thanks.

    The stored procedure just selects all the fields from a table where certain fields are null.

    function CTRL37_7::OnClick(eventObj)
    {

    //Set the Command for the Query Adapter of the Data Source.
    XDocument.QueryAdapter.Command = "execute sp_it_NewCallTickets";

    //Query the Data Source.
    XDocument.Query();
    }


    ERROR:
    The following error occurred:

    The query method on the Document object failed.
    InfoPath cannot run the specified query.
    The XML data returned from the data source does not match the XML Schema for this form. This discrepancy might be caused by the data source returning multiple rows when InfoPath expects only one.
    Element 'http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}call_tickets' is unexpected according to content model of parent element 'http://schemas.microsoft.com/office/infopath/2003/dataFormSolution}dataFields'.
    Expecting: http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}Call_tickets.


    File:script.js
    Line:30

  • 08-31-2006 01:06 PM In reply to

    Re: Form won't return data from a sql stored procedure

    Ouch, it looks like the difference between "C" and "c" is getting you. Is there any way you can alter the SPROC to make sure that it returns a column name consistently? Otherwise, you could extract the form files and change the schema file for this secondary data connection, or alter the XML that is returned by the SPROC in code manually.

    I hope this gives you some direction, I know its pretty vague, but I think this is the direction you should take.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-18-2007 10:05 AM In reply to

    • Tome
    • Not Ranked
      Male
    • Joined on 01-18-2007
    • USA
    • Posts 16

    Re: Form won't return data from a sql stored procedure

    I#%92ve been running into the same problem but only at a certain point.

    The user selects a Business Unit ID and a Contract #, then clicks the "New SR Number" button, as shown in the form screen shot below. A stored procedure is called and run to calculate the sequential number where it returns the new service receipt record. All seems to work well; I can change the header information and submit. I see the error when I insert records into any of the associated tables like employees or equipment and then try to submit.

    I have access to modify the Stored procedure which I have been attempting to do but without success. I'm fairly new to SQL Server so there are some uncertainties on my end. I can post the SQL statement if it would help.

    It appears to me that SQL server is not returning the schema for the associated tables. If this is the case, how do I go about making the schema match? Does anyone have any websites that would help me?

    Here is what my main connection looks like.


    Here is the form.


    George Ball
    VeoliaES
    [email protected]
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.