<?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>SQL Database Integration</title><link>https://www.infopathdev.com:443/forums/47.aspx</link><description>For questions concerning issues in the integration of SQL and Microsoft InfoPath.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17248.aspx</link><pubDate>Tue, 07 Mar 2006 19:35:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17248</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17248.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17248</wfw:commentRss><description>OK..here is what I had to do:&lt;br /&gt;1) create a sql table to hold my value that I want - used for this sp ONLY!&lt;br /&gt;2) change the sp to do the calcs...truncate the tbl that has my value...insert the value into the tbl...select the value&lt;br /&gt;3) create a 2ndairy ds to 'xml mate'with my new tbl&lt;br /&gt;4) issue the sp query from the 2ndairy ds adapter &lt;br /&gt;5) grab the data from the 2ndairy ds and post to the form fields/main ds</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17247.aspx</link><pubDate>Tue, 07 Mar 2006 13:40:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17247</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17247.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17247</wfw:commentRss><description>Lets look at this differently...I can construct the sp to select the output parameter-therby giving me the result I want in the return set as opposed to the output parameter...I've tried that with the following code:&lt;br /&gt;&lt;br /&gt;function btnReproc::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;	// Write your code here&lt;br /&gt;	//Retrieve the value of the field that you want to use as a parameter&lt;br /&gt;	//to the stored procedure.&lt;br /&gt;	var sPiece = getNodeValue("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail/@Piece");&lt;br /&gt;	XDocument.UI.Alert(sPiece);&lt;br /&gt;	&lt;br /&gt;	//Set the Command for the Query Adapter of the Data Source. Incorporate the&lt;br /&gt;	//parameter values that you want to use.&lt;br /&gt;&lt;br /&gt;	var strSQL = 'execute "prGetPieceRPCost" sPiece';&lt;br /&gt;	XDocument.UI.Alert(strSQL);&lt;br /&gt;&lt;br /&gt;	XDocument.QueryAdapter.Command = strSQL;&lt;br /&gt;	&lt;br /&gt;	//Query the Data Source.&lt;br /&gt;	XDocument.Query();&lt;br /&gt;	XDocument.UI.Alert("sp query completed");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;and get this error:&lt;br /&gt;&lt;br /&gt;InfoPath cannot run the specified query.&lt;br /&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;br /&gt;Element '&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}row'&gt;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}row'&lt;/a&gt; is unexpected according to content model of parent element '&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopathe/2003/dataFormSolution}dataFields'.&gt;http://schemas.microsoft.com/office/infopathe/2003/dataFormSolution}dataFields'.&lt;/a&gt;&lt;br /&gt;Expecting: &lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}tblRAHeader.&gt;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}tblRAHeader.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The tblRAHeader is part of the main data source. &lt;br /&gt;I guess the ??? now is which adapter to use (and how) to retrieve the return set? Or do I need to try to make the sp return set appear like the main data source return sset...is that possible?  Here is the sp:&lt;br /&gt;&lt;br /&gt;ALTER     PROCEDURE dbo.prGetPieceRPCost  (&lt;br /&gt;	@Piece char(7)&lt;br /&gt;	)&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;declare @ret int, @RPCost int, @Cost Int&lt;br /&gt;&lt;br /&gt;set @Cost = (select ReturnsFixedCostPerPiece from vwReturnsFixedCostPerPiece)&lt;br /&gt;&lt;br /&gt;exec @ret = prCalcRPVarCost @Piece, @RPCost output&lt;br /&gt;&lt;br /&gt;set @Cost = @Cost + @RPCost&lt;br /&gt;select @Cost as ReProccessedDollars&lt;br /&gt;return&lt;br /&gt;&lt;br /&gt;the sp runs fine and returns 17 as the ReProcessedDollars...which I (hoped to ) matched to one of the fields in my main data source \d:tblRAHeader\d:tblRADetail\@ReProcessedDollars..which is also a form field&lt;br /&gt;</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17246.aspx</link><pubDate>Mon, 06 Mar 2006 20:07:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17246</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17246.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17246</wfw:commentRss><description>Hi Brandt,&lt;br /&gt;&lt;br /&gt;I'm not sure what is causing that error, but I think it has something to do with not having the proper libraries installed. Like I said, it worked for me so maybe it was packed with my installation of Visual Studio. Maybe someone else has had the same problem, I would consult Google.</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17245.aspx</link><pubDate>Mon, 06 Mar 2006 19:04:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17245</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17245.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17245</wfw:commentRss><description>Matt-I dnld &amp; instlled the MDSCSDK2.8 and now I get&lt;br /&gt;&lt;br /&gt;"Automation server can't create onject"</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17244.aspx</link><pubDate>Mon, 06 Mar 2006 14:23:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17244</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17244.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17244</wfw:commentRss><description>Sounds like you don't have something installed. I'm not sure what your development environment is, but the ADO stuff installed itself for me.&lt;br /&gt;&lt;br /&gt;Try downloading and installing this:&lt;br /&lt;a target="_blank" href=http://www.microsoft.com/downloads/details.aspx?familyid=5067faf8-0db4-429a-b502-de4329c8c850&amp;displaylang=en&gt;http://www.microsoft.com/downloads/details.aspx?familyid=5067faf8-0db4-429a-b502-de4329c8c850&amp;displaylang=en&lt;/a&gt;</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17243.aspx</link><pubDate>Mon, 06 Mar 2006 14:00:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17243</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17243.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17243</wfw:commentRss><description>Hi Matt...I get the following error on:&lt;br /&gt;	var oCommand = new ActiveXObject("ADODB.Command");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;"Microsoft JScript runtime error: Automation server cam't create object"&lt;br /&gt;&lt;br /&gt;tnx</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17242.aspx</link><pubDate>Mon, 06 Mar 2006 01:56:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17242</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17242.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17242</wfw:commentRss><description>Hi Brandt,&lt;br /&gt;&lt;br /&gt;In exploring this issue I used the AdventureWorks database that comes as an example with most installations of SQL. I called the following stored procedure to retrieve two output parameters:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;USE AdventureWorks;&lt;br /&gt;GO&lt;br /&gt;IF OBJECT_ID ( 'Production.usp_GetList', 'P' ) IS NOT NULL &lt;br /&gt;    DROP PROCEDURE Production.usp_GetList;&lt;br /&gt;GO&lt;br /&gt;CREATE PROCEDURE Production.usp_GetList &lt;br /&gt;	@product varchar(40) -- Index 1 in Command.Parameters collection&lt;br /&gt;    , @maxprice money -- Index 2&lt;br /&gt;    , @compareprice money OUTPUT -- Index 3, Note that this simply roundtrips the @maxprice variables&lt;br /&gt;    , @listprice money OUTPUT -- Index 4&lt;br /&gt;AS&lt;br /&gt;    SELECT p.name AS Product, p.ListPrice AS 'List Price'&lt;br /&gt;    FROM Production.Product p&lt;br /&gt;    JOIN Production.ProductSubcategory s &lt;br /&gt;      ON p.ProductSubcategoryID = s.ProductSubcategoryID&lt;br /&gt;    WHERE s.name LIKE @product AND p.ListPrice &amp;lt; @maxprice;&lt;br /&gt;-- Populate the output variable @listprice.&lt;br /&gt;SET @listprice = (SELECT MAX(p.ListPrice)&lt;br /&gt;        FROM Production.Product p&lt;br /&gt;        JOIN  Production.ProductSubcategory s &lt;br /&gt;          ON p.ProductSubcategoryID = s.ProductSubcategoryID&lt;br /&gt;        WHERE s.name LIKE @product AND p.ListPrice &amp;lt; @maxprice);&lt;br /&gt;-- Populate the output variable @compareprice.&lt;br /&gt;SET @compareprice = @maxprice;&lt;br /&gt;GO&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This is the JScript code that I used to call the stored procedure and then retrieve the two output parameters:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;// Create the command object	 &lt;br /&gt;var oCommand = new ActiveXObject("ADODB.Command");&lt;br /&gt;&lt;br /&gt;// Set the connection to be the same as the main DOM&lt;br /&gt;oCommand.ActiveConnection = XDocument.QueryAdapter.Connection;&lt;br /&gt;&lt;br /&gt;// Set the command type to adCmdStoredProc&lt;br /&gt;// Ref:&lt;a target="_blank" href=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdcstcommandtypeenum.asp&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdcstcommandtypeenum.asp&lt;/a&gt;&lt;br /&gt;oCommand.CommandType = 4;&lt;br /&gt;&lt;br /&gt;// Name of the stored procedure&lt;br /&gt;oCommand.CommandText = "Production.usp_GetList" ;&lt;br /&gt;&lt;br /&gt;// Set the values of the parameters&lt;br /&gt;// Start at index 1, because index 0 is @RETURN_VALUE&lt;br /&gt;oCommand.Parameters(1) = "%Bikes%";&lt;br /&gt;oCommand.Parameters.Item(2) = 700;&lt;br /&gt;&lt;br /&gt;// Execute the stored procedure&lt;br /&gt;oCommand.Execute();	&lt;br /&gt;&lt;br /&gt;// Retrieve the output parameters	&lt;br /&gt;XDocument.UI.Alert( oCommand.Parameters(3) + "      " + oCommand.Parameters(4) );&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Hopefully from here you should be able to modify to work in your solution. If you have any questions, let me know! :)</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17241.aspx</link><pubDate>Sun, 05 Mar 2006 14:17:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17241</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17241.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17241</wfw:commentRss><description>many thnx!</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17240.aspx</link><pubDate>Sat, 04 Mar 2006 23:19:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17240</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17240.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17240</wfw:commentRss><description>Hi Brandt,&lt;br /&gt;We have written a lot of code to interface with DBs using ADO.NET. I will ask one of our developers to respond to you this weekend.</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17239.aspx</link><pubDate>Sat, 04 Mar 2006 21:30:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17239</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17239.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17239</wfw:commentRss><description>I have a sp that has one input parameter (Piece char(7)) and one output &lt;br /&gt;parameter (Cost )...the sp works fine but I can't figure out how to:&lt;br /&gt;a) get the sp to run in ip&lt;br /&gt;b) I really need the OUTPUT parameter&lt;br /&gt;&lt;br /&gt;sp: PROCEDURE dbo.prGetPieceReprocCost  (&lt;br /&gt;	@Piece char(7),&lt;br /&gt;	@Cost char(7) null output&lt;br /&gt;	)&lt;br /&gt;&lt;br /&gt;Pretty complex sp to calc the cost.&lt;br /&gt;Both Piece &amp; Cost are in the main data source.&lt;br /&gt;&lt;br /&gt;My code so far is:&lt;br /&gt;function btnReproc::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;	//Retrieve the value of the field that you want to use as a parameter&lt;br /&gt;	//to the stored procedure.&lt;br /&gt;	var sPiece = &lt;br /&gt;getNodeValue("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail/@Piece");&lt;br /&gt;	XDocument.UI.Alert(sPiece);&lt;br /&gt;&lt;br /&gt;	//Set the Command for the Query Adapter of the Data Source. Incorporate the&lt;br /&gt;	//parameter values that you want to use.&lt;br /&gt;	var retCost = 0&lt;br /&gt;	var strSQL = 'execute "prGetPieceReprocCost" ' + '"' + sPiece + '"' + ' &lt;br /&gt;,retCost output';&lt;br /&gt;	XDocument.UI.Alert(strSQL);&lt;br /&gt;&lt;br /&gt;	XDocument.QueryAdapter.Command = strSQL;&lt;br /&gt;	&lt;br /&gt;	//Query the Data Source.&lt;br /&gt;	XDocument.Query();&lt;br /&gt;&lt;br /&gt;and I get : Cannot use the OUTPUT option when passing a constant to a stored &lt;br /&gt;procedure&lt;br /&gt;_______________________________________________________&lt;br /&gt;&lt;br /&gt;Patrick-after more research I understand that this is not possinle w/o using ADO...I still need an example of the ADO code...&lt;br /&gt;_____________________________________________________&lt;br /&gt;&lt;br /&gt;Here is the response I got on mSDN:&lt;br /&gt;The Command property of the QueryAdapter is a string, not an object, which is &lt;br /&gt;why you are getting the error, since the OUTPUT parameter cannot be returned. &lt;br /&gt;You will not be able to retrieve an output value returned by a stored &lt;br /&gt;procedure by using this Command property. You need to use the Command object &lt;br /&gt;of ADODB (see&lt;a target="_blank" href=http://support.microsoft.com/?kbid=185125&gt;http://support.microsoft.com/?kbid=185125&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;For JScript, you would have to instantiate a Command object like this:&lt;br /&gt;var objCommand = new ActiveXObject("ADODB.Command");&lt;br /&gt;&lt;br /&gt;Then set the ActiveConnection and fill the Parameters collection on the &lt;br /&gt;Command object, call Execute on the Command object, close the connection, &lt;br /&gt;refresh the Parameters collection, and then retrieve the value of the output &lt;br /&gt;parameter.&lt;br /&gt;---&lt;br /&gt;___________________________________________________________________&lt;br /&gt;&lt;br /&gt;I'm going to need a JScript example of this for sure...thanks&lt;br /&gt;Brandt</description></item><item><title>Re: Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/17238.aspx</link><pubDate>Sat, 04 Mar 2006 21:16:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17238</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17238.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17238</wfw:commentRss><description>Hi Brandt,&lt;br /&gt;Can you please explain your scenario a bit more?</description></item><item><title>Get OUTPUT parameter from Stored Procedure</title><link>https://www.infopathdev.com:443/forums/thread/16791.aspx</link><pubDate>Sat, 04 Mar 2006 17:19:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:16791</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/16791.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=16791</wfw:commentRss><description>How do you get a/the output parameter from a sp using javascript?</description></item></channel></rss>