473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

adodbapi return value

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
1 2431
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Achim Domma | last post by:
Hi, I read a webpage via urllib2. The result of the 'read' call is of type 'str'. This string can be written to disc via file('out.html','w').write(html). Then I write the string into a...
1
by: Sangbae | last post by:
I cannot create table using adodbapi. I have no problem with SELECT etc. But I can create table using win32com.client directly. I don't know why. Could you give some advice, please? This...
0
by: Raaijmakers, Vincent \(GE Infrastructure\) | last post by:
Hopefully posted on the correct newsgroup. The adodbapi group seems so quit.... I want to distinguish between 1) an error in the sql statement to create a table, and 2) when the sql is...
1
by: Max Ischenko | last post by:
Hi, I'm using adodbapi wrapper arount OLEDB driver and I got this error when calling adodbapi.connect(): (-2147221008, 'CoInitialize has not been called.', None, None) The weird part is that...
0
by: Max Ischenko | last post by:
I'm using adodbapi DBAPI module to access SQL server and trying to pass a GUID parameter with an SQL statement. But it doesn't work: I got "incorrect cast expression" from the ADO. If I paste GUID...
4
by: nightmarch | last post by:
I want use crsr.nextset() , But I got errors like following: >>> connStr = "Provider=MSDAORA.1;Password=jmpower;User ID=jmpower;Data Source=jmgis_agps3;Persist Security Info=True" >>> import...
0
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi All, I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a procedure and then I select from that dynamic table to...
0
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi All, Could someone please help me with an issue I am having. I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a...
3
by: leesquare | last post by:
Hello, I need some help getting output values from my stored procedures when using adodbapi. There's an example testVariableReturningStoredProcedure in adodbapitest.py, and that works for my...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.