By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,526 Members | 1,618 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,526 IT Pros & Developers. It's quick & easy.

adodbapi return value

P: n/a
I'm trying to use the adodbapi module, but run into the following
problem:

After initalization (connection, cursor) I have the following call to
a stored procedure (SQL Server, using SQLOLEDB.1 provider).

m = u'BrReg'
rs = u''
msg = u''
x = self.cur.callproc('__DocFetchBaseCategories', (0, 0, m, rs, msg))
print x
[0, 0, u'BrReg', u'', u''] print self.cur.returnValue None print self.cur.rowcount -1


The procedure is enclosed below. Strange thing is that if the
variable 'm' is set to an empty string, everything works ok, the
resultstate value (x[3]) becomes '_OK'. However having the variable
'm' set to 'BrReg' as indicated, seems to result in the returned set
(x) not being updated. When executing the Stored Procedure in Query
Analyzer, everything seems to be ok (BrReg is a valid value and
results in both '_OK' resultstate and a set of values (record set)).

When using the value m='', the returnValue when printed is 0.

---------------------------- FRAGMENT OF SQL CODE --------------------
create proc __DocFetchBaseCategories (
@TraceLevel int,
@UserId int,
@Module varchar(32),
@Resultstate varchar(121) output,
@Message varchar(255) output
) as
begin
if @Module <> ''
begin
select 10000,
C.Category,
C.BaseCategory,
C.CategoryDescription
from _DerivedCategories D, _Categories C
where D.Category like (@Module + '[_]%')
and not D.BaseCategory like (@Module + '[_]%')
and D.DerivedLevel = 1
and D.Category = C.Category
end
else
begin
select 10000,
Category,
BaseCategory,
CategoryDescription
from _Categories
where BaseCategory = ''
end

select @ResultState = '_OK',
@Message = ''

NormalExit:

end

--------------------------------------------------------------------------------------------
The connection object reports 0 ADOerrors when I use the method
printADOerrors on the connection object.

Any help is appreciated.
Nikolai Kirsebom
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Found out what's wrong. The "Output Parameter Availablity" property
of the connection has the value DBPROPVAL_OA_ATROWRELEASE. By closing
the record set (reading out the result set first) the output
parameters were correct. Made the modification directly in the
executeHelper method of the Cursor object. Changed at the end of the
method;

if isStoredProcedureCall and parameters != None:
return self._returnADOCommandParameters(self.cmd)

to

if isStoredProcedureCall and parameters != None:
x = self.fetchall()
rs.Close()
return self._returnADOCommandParameters(self.cmd), x

Guess this is not the right way. Any comments appreciated.
Nikolai Kirsebom

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.