<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Executing a stored procedure with OUTPUT parameters</title><link>https://www.infopathdev.com:443/blogs/jimmy/archive/2009/08/01/executing-a-stored-procedure-with-output-parameters.aspx</link><description>Many people are aware that you can use InfoPath code or script to perform all sorts of database queries on tables, views, stored procedures and the like. I won&amp;#39;t go into the details here, but you can read more about this at the following links: http</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>re: Executing a stored procedure with OUTPUT parameters</title><link>https://www.infopathdev.com:443/blogs/jimmy/archive/2009/08/01/executing-a-stored-procedure-with-output-parameters.aspx#49505</link><pubDate>Mon, 30 Nov 2009 05:32:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49505</guid><dc:creator>Jimmy</dc:creator><description>&lt;p&gt;Hey sasyregak,&lt;/p&gt;
&lt;p&gt;Sorry for not responding to your post until now. &amp;nbsp;I don't get notifications about comments on my blog posts and the easiest way to get a response is to open a new forum post.&lt;/p&gt;
&lt;p&gt;It sounds like you are trying to use this technique on your main data source. &amp;nbsp;InfoPath performs schema validation on the main data source and an operation like this that returns a schema other than the expected one will cause that error.&lt;/p&gt;
&lt;p&gt;Might you be able to try this technique on a secondary data source?&lt;/p&gt;
&lt;img src="https://www.infopathdev.com:443/aggbug.aspx?PostID=49505" width="1" height="1"&gt;</description></item><item><title>Social comments and analytics for this post</title><link>https://www.infopathdev.com:443/blogs/jimmy/archive/2009/08/01/executing-a-stored-procedure-with-output-parameters.aspx#48422</link><pubDate>Fri, 30 Oct 2009 16:56:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:48422</guid><dc:creator>uberVU - social comments</dc:creator><description>&lt;p&gt;This post was mentioned on Twitter by InfoPathDev: Blog: Executing a stored procedure with OUTPUT parameters in InfoPath - &lt;a rel="nofollow" target="_new" href="http://su.pr/7WfE2W"&gt;http://su.pr/7WfE2W&lt;/a&gt;&lt;/p&gt;
&lt;img src="https://www.infopathdev.com:443/aggbug.aspx?PostID=48422" width="1" height="1"&gt;</description></item><item><title>re: Executing a stored procedure with OUTPUT parameters</title><link>https://www.infopathdev.com:443/blogs/jimmy/archive/2009/08/01/executing-a-stored-procedure-with-output-parameters.aspx#46387</link><pubDate>Fri, 28 Aug 2009 13:02:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:46387</guid><dc:creator>sasyregak</dc:creator><description>&lt;p&gt;Further after trouble shooting....I am able to find the output of the query in query analyser giving rise to a date value(single).&lt;/p&gt;
&lt;p&gt;But the preview on infopath given the following error&lt;/p&gt;
&lt;p&gt;The query cannot be run for the following DataObject: Report connection&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Element '{&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"&gt;schemas.microsoft.com/.../dataFields&lt;/a&gt;}row' is unexpected according to content model of parent element '{&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"&gt;schemas.microsoft.com/.../dataFormSolution&lt;/a&gt;}dataFields'.&lt;/p&gt;
&lt;p&gt;Expecting: {&lt;a rel="nofollow" target="_new" href="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"&gt;schemas.microsoft.com/.../dataFields&lt;/a&gt;}FileGeneralInfo.&lt;/p&gt;
&lt;p&gt;Appreciate your help on this.....&lt;/p&gt;
&lt;img src="https://www.infopathdev.com:443/aggbug.aspx?PostID=46387" width="1" height="1"&gt;</description></item><item><title>re: Executing a stored procedure with OUTPUT parameters</title><link>https://www.infopathdev.com:443/blogs/jimmy/archive/2009/08/01/executing-a-stored-procedure-with-output-parameters.aspx#46328</link><pubDate>Thu, 27 Aug 2009 12:46:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:46328</guid><dc:creator>sasyregak</dc:creator><description>&lt;p&gt;Jimmy&lt;/p&gt;
&lt;p&gt;Thanks for your tips... I was stuggling to get this achieved.&lt;/p&gt;
&lt;p&gt;/ Get the default SQL command for the form.&lt;/p&gt;
&lt;p&gt;var strOrigSQLCommand = XDocument.QueryAdapter.Command;&lt;/p&gt;
&lt;p&gt;//Find the value of the filter criteria&lt;/p&gt;
&lt;p&gt;var strInspectionValuationhistory = XDocument.DOM.selectSingleNode(&amp;quot;/dfs:myFields/dfs:queryFields/q:Inspection_Valuation_history&amp;quot;);&lt;/p&gt;
&lt;p&gt;var strvisit = strInspectionValuationhistory.selectSingleNode(&amp;quot;@Which_visit&amp;quot;).text;&lt;/p&gt;
&lt;p&gt;strvisit = strvisit - 1; //store the previous visit value&lt;/p&gt;
&lt;p&gt;if(strvisit != &amp;quot;&amp;quot;)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	strpreviousvisitSQLcommand = &amp;quot;DECLARE @Previousvisitdate datetime &amp;quot; + &amp;quot; EXECUTE test &amp;quot; + strvisit + &amp;quot; ,@Previousvisitdate OUTPUT &amp;quot; + &amp;quot; SELECT @Previousvisitdate as previousdate&amp;quot;;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(strpreviousvisitSQLcommand);&lt;/p&gt;
&lt;p&gt;XDocument.QueryAdapter.Command = strpreviousvisitSQLcommand;&lt;/p&gt;
&lt;p&gt;XDocument.Query();&lt;/p&gt;
&lt;p&gt;//Here i need to get the result stored in a global variable , so that i can refer in any other view whereever required.......please guide me&lt;/p&gt;
&lt;p&gt;XDocument.QueryAdapter.Command = strOrigSQLCommand;&lt;/p&gt;
&lt;p&gt;XDocument.Query();&lt;/p&gt;
&lt;img src="https://www.infopathdev.com:443/aggbug.aspx?PostID=46328" width="1" height="1"&gt;</description></item></channel></rss>