<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Vernon,<br>
<br>
I have now also tested this with SQL Server Express 2005 on vista and
am still getting an error.&nbsp; <br>
<br>
I am adding my previous email to you here for the benefit of the list:<br>
<blockquote>On both XP and Vista, I am using 2.2.5.&nbsp; I don't see a
2.2.6 on
sourceforge.&nbsp; <br>
  <br>
As for the SQL Server versions, I have tested on both 2000 and 2005.&nbsp; I
am currently in the process of installing the SQL Express 2005 version
to see if I get a different result.<br>
  <br>
FYI, you can get SQL Server Management Studio Express for free
(replaces Query Analyzer in 2005):<br>
  <br>
  <a class="moz-txt-link-freetext"
 href="http://www.microsoft.com/Sqlserver/2005/en/us/express-down.aspx#SP3">http://www.microsoft.com/Sqlserver/2005/en/us/express-down.aspx#SP3</a><br>
  <br>
Direct download for the studio:<br>
  <br>
  <a class="moz-txt-link-freetext"
 href="http://go.microsoft.com/fwlink/?linkid=65110">http://go.microsoft.com/fwlink/?linkid=65110</a></blockquote>
<pre class="moz-signature" cols="72">--------------------------------------
Randy Syring
RCS Computers &amp; Web Solutions
502-644-4776
<a class="moz-txt-link-freetext" href="http://www.rcs-comp.com">http://www.rcs-comp.com</a>

"Whether, then, you eat or drink or 
whatever you do, do all to the glory
of God." 1 Cor 10:31
</pre>
<br>
<br>
Vernon Cole wrote:
<blockquote
 cite="mid:b7eb4a700905261228j202c60c9xf39f0e5b2ccd14ea@mail.gmail.com"
 type="cite">
  <pre wrap="">Randy:
Just to make sure...
what version of adodbapi are we talking about?

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">import adodbapi
adodbapi.version
        </pre>
      </blockquote>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->'adodbapi v2.2.6 '
  </pre>
  <pre wrap=""><!---->--
Vernon

On Tue, May 26, 2009 at 1:16 PM, Randy Syring <a class="moz-txt-link-rfc2396E" href="mailto:randy@rcs-comp.com">&lt;randy@rcs-comp.com&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Vernon,

I didn't mention this in my last email, but I also tried the:

SET&nbsp; @param = 10

syntax, but that didn't change anything.&nbsp; I am still getting a failing test
on 2.5 (XP) and (2.6) Vista.

--------------------------------------
Randy Syring
RCS Computers &amp; Web Solutions
502-644-4776
<a class="moz-txt-link-freetext" href="http://www.rcs-comp.com">http://www.rcs-comp.com</a>

"Whether, then, you eat or drink or
whatever you do, do all to the glory
of God." 1 Cor 10:31


Vernon Cole wrote:

According to PEP 249...
        .callproc(procname[,parameters])
            Call a stored database procedure with the given name. The
            sequence of parameters must contain one entry for each
            argument that the procedure expects. The result of the
            call is returned as modified copy of the input
            sequence. Input parameters are left untouched, output and
            input/output parameters replaced with possibly new values.

            The procedure may also provide a result set as
            output. This must then be made available through the
            standard .fetch*() methods.

In this case, the proceedure outputs TWO record sets, since there are
two SELECT statements.
If the second select statement, "select @param = 10" were changed to
"SET  @param = 10" then, I believe, the result
would have been as expected.
  As it stands, the Python programmer should be required to do a
cursor.nextset() and a .fetch() in order to read the result of the
second SELECT statement.

     .nextset()
            This method will make the cursor skip to the next
            available set, discarding any remaining rows from the
            current set.

            If there are no more sets, the method returns
            None. Otherwise, it returns a true value and subsequent
            calls to the fetch methods will return rows from the next
            result set.

Having said all that, I ran Randy's test program using pywin32 v213 on
Python 2.6 and Vista, and it ran correctly.
--
Vernon

On Fri, May 22, 2009 at 6:50 AM, Roger Upole <a class="moz-txt-link-rfc2396E" href="mailto:rwupole@msn.com">&lt;rwupole@msn.com&gt;</a> wrote:


Randy Syring wrote:


I found this post:


<a class="moz-txt-link-freetext" href="http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters">http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters</a>

which was helpful in getting me started. &nbsp;However, that method does not
yield the output parameters if a recordset is output in the SP. &nbsp;So, if
my SP is:

&nbsp; CREATE PROCEDURE sp_test_only_output
&nbsp; @param INTEGER OUTPUT
&nbsp; AS
&nbsp; BEGIN
&nbsp; select @param = 10
&nbsp; END

Then:

&nbsp; assert [10] == self.cur.callproc('sp_test_only_output',(999,))

But, if my SP is:

&nbsp; CREATE PROCEDURE sp_test_output_and_select
&nbsp; @param INTEGER OUTPUT
&nbsp; AS
&nbsp; BEGIN
&nbsp; select 'one', 'two'
&nbsp; select @param = 10
&nbsp; END

then:

&nbsp; self.cur.callproc('sp_test_output_and_select',(999,)) == [999]

A full test that can be run with Nose: <a class="moz-txt-link-freetext" href="http://paste.pocoo.org/show/118219/">http://paste.pocoo.org/show/118219/</a>

Can you please help me figure out what is going on. &nbsp;I realize output
parameters are not the best solution, but I am working with systems that
I can't change the SPs on and would like to use Python rather than be
forced into using a different language.

Thank you!



I've run into this somewhere before. &nbsp;It turns out that the output parms are
actually returned as an extra recordset, so you need to call NextRecordset
before trying to access them.



>From digging into the source, if you add


rs.NextRecordset() at line 741 of adodbapi.py, the output parm
is returned as expected.

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Roger

_______________________________________________
python-win32 mailing list
<a class="moz-txt-link-abbreviated" href="mailto:python-win32@python.org">python-win32@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</a>



_______________________________________________
python-win32 mailing list
<a class="moz-txt-link-abbreviated" href="mailto:python-win32@python.org">python-win32@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-win32">http://mail.python.org/mailman/listinfo/python-win32</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>