hi thanks for the reply.<br>
I went to try the codes out<br>
<br>
def exec_updtstmt(Svr,Login,Pass,Db,SQL):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''' Connects to database specified, exec the SQL and returns value'''<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
db = Sybase.connect(Svr, Login,Pass ,Db)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
c =
db.cursor()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
c.execute(SQL)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
print &quot;Cursor rowcount after update (no rows) is: %d&quot; % c.rowcount<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
db.commit()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
db.close()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except Sybase.DatabaseError:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return 9<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 2<br>
<br>
stmt = '''<br>
update table<br>
set col_1 =&nbsp; 1<br>
where login = &quot;user&quot;<br>
'''<br>
<br>
exec_updtstmt(Svr,Login,Pass,DbInt,stmt)<br>
<br>
what i got is &quot;Cursor rowcount after update (no rows) is: -1&quot; and when i checked the table<br>
it is updated. Although the update works, i would wish to get that return to indicate to the user whether success or failure<br>
.<br>
thanks for any further help<br>
<br>
<br>
<br><br><div><span class="gmail_quote">On 10/26/05, <b class="gmail_sendername">Nidositko, James</b> &lt;<a href="mailto:James.Nidositko@gs.com">James.Nidositko@gs.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Mike,<br>There is no inherent concept of a &quot;return value&quot; from an executed SQL<br>statement.&nbsp;&nbsp;You can produce such a result by encapsulating your SQL<br>statements within stored procedures by detecting the rowcount and setting
<br>the return value in response, but there isn't really any need for you to do<br>that.<br><br>1) It sounds like the error case that you're trying to describe below should<br>be detected by getting a rowcount of zero from the update.
<br><br>2)&nbsp;&nbsp;Rowcount does work.&nbsp;&nbsp;Here is some sample code that will show rowcount<br>working in various situations.<br><br>&nbsp;&nbsp;c=dbc.cursor()<br>&nbsp;&nbsp;print &quot;Cursor rowcount is initialized to: %d&quot; % c.rowcount<br>&nbsp;&nbsp;c.execute
(&quot;create table __test_rowcount (col1 varchar(10) NULL)&quot;)<br>&nbsp;&nbsp;print &quot;Cursor rowcount after create table is: %d&quot; % c.rowcount<br><br>&nbsp;&nbsp;c.execute(&quot;insert __test_rowcount (col1) values ('asdf')&quot;)
<br>&nbsp;&nbsp;print &quot;Cursor rowcount after insert 1 is: %d&quot; % c.rowcount<br><br>&nbsp;&nbsp;c.execute(&quot;insert __test_rowcount (col1) values ('asdf')&quot;)<br>&nbsp;&nbsp;print &quot;Cursor rowcount after insert 2 is: %d&quot; % c.rowcount
<br><br>&nbsp;&nbsp;c.execute(&quot;update __test_rowcount set col1 = 'qwer' where col1 = 'asdf'&quot;)<br>&nbsp;&nbsp;print &quot;Cursor rowcount after update is: %d&quot; % c.rowcount<br><br>&nbsp;&nbsp;c.execute(&quot;update __test_rowcount set col1 = 'qwer' where col1 = 'not
<br>there'&quot;)<br>&nbsp;&nbsp;print &quot;Cursor rowcount after update (no rows) is: %d&quot; % c.rowcount<br><br>&nbsp;&nbsp;c.execute(&quot;select count(*) from&nbsp;&nbsp;__test_rowcount&quot;)<br>&nbsp;&nbsp;print &quot;Cursor rowcount after execute for select is: %d&quot; % 
c.rowcount<br>&nbsp;&nbsp;c.fetchall()<br>&nbsp;&nbsp;print &quot;Cursor rowcount after fetch for select is: %d&quot; % c.rowcount<br><br>&nbsp;&nbsp;c.execute(&quot;delete __test_rowcount where col1 = 'qwer'&quot;)<br>&nbsp;&nbsp;print &quot;Cursor rowcount after delete is: %d&quot; % 
c.rowcount<br><br>The only unusual case is select.&nbsp;&nbsp;Then, the rowcount is not set until the<br>fetch is performed.<br><br>-Jim<br><br>-----Original Message-----<br>From: <a href="mailto:python-sybase-bounces@www.object-craft.com.au">
python-sybase-bounces@www.object-craft.com.au</a><br>[mailto:<a href="mailto:python-sybase-bounces@www.object-craft.com.au">python-sybase-bounces@www.object-craft.com.au</a>] On Behalf Of<br><a href="mailto:python-sybase-request@www.object-craft.com.au">
python-sybase-request@www.object-craft.com.au</a><br>Sent: Tuesday, October 25, 2005 10:00 PM<br>To: <a href="mailto:python-sybase@www.object-craft.com.au">python-sybase@www.object-craft.com.au</a><br>Subject: Python-sybase Digest, Vol 5, Issue 3
<br><br><br>Today's Topics:<br><br>&nbsp;&nbsp; 1. how to get return value of update/delete statement (michael lee)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Tue, 25 Oct 2005 18:30:07 +0800
<br>From: michael lee &lt;<a href="mailto:mik3l3374@gmail.com">mik3l3374@gmail.com</a>&gt;<br>Subject: [python-sybase] how to get return value of update/delete<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;statement<br>To: Python Sybase &lt;<a href="mailto:python-sybase@www.object-craft.com.au">
python-sybase@www.object-craft.com.au</a>&gt;<br>Message-ID:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<a href="mailto:e3202a160510250330t7306ecd6p79b4517d42e5bc2c@mail.gmail.com">e3202a160510250330t7306ecd6p79b4517d42e5bc2c@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br><br>hi<br>how can i successfully get the return of an update or delete statement using<br>the Sybase module?<br> i am doing a CGI script whereby if a user keys in the wrong name, i would
<br>want to catch that error&nbsp;&nbsp;eg if key in wrong username, my CGI script will<br>call Sybase to execute &lt; update table set this = a-value where name =<br>'wronguser' &gt; and then return a value indicating &quot;not found&quot;
<br>but i am not able to figure out how to catch this return value. Any advise?<br> ....<br>cur.execute(update_statement)<br>....<br> my table is being updated though when i tried a valid user. I tried<br>rowcount but also not working.
<br>thanks<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL:<br><a href="http://www.object-craft.com.au/pipermail/python-sybase/attachments/20051025/">http://www.object-craft.com.au/pipermail/python-sybase/attachments/20051025/
</a><br>0c35109c/attachment-0001.html<br><br>------------------------------<br><br>_______________________________________________<br>Python-sybase mailing list<br><a href="mailto:Python-sybase@www.object-craft.com.au">Python-sybase@www.object-craft.com.au
</a><br><a href="https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase">https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase</a><br><br><br>End of Python-sybase Digest, Vol 5, Issue 3<br>
*******************************************<br></blockquote></div><br>