ADO Command object/Parameters problem...

candiazoo at attbi.com candiazoo at attbi.com
Thu Jun 13 21:18:42 EDT 2002


I am still having problems using dynamic sql statements to perform lookups and
inserts into a MS Access database and an Oracle database.  I've looked up the
error at Microsoft and the solution is to find the OLEDB provider and add
"OLEDB_SERVICES" DWORD value to the registry entry... did this (actually, it
already HAD it)... no go.  I used MakePy... no go.  The code I used works in a
VB application.  I used the errors collection from the connection object and it
only gives me a more concise version of what you see below.  Does anyone have
any idea why I cannot create a command object with parameter objects??  I am
using only adVarChar and adNumeric values... no dates, no blobs, nothing odd at
all...!!!

Has anyone else run into this (note: I have seen other entries for the same
error, which is rather generic, but not for my specific reason).

Thank you, in advance...

Mike J.

-----------------------------------------------------------------------------------------------------------------------------------------
begin updating recType[s] on Thu Jun 13 12:15:39 2002
Traceback (most recent call last):
  File "C:\Documents and Settings\mjessop\My Documents\Python Development\Catalo
g\BuildCatalog.py", line 1300, in ?
    setRecordType()
  File "C:\Documents and Settings\mjessop\My Documents\Python Development\Catalo
g\BuildCatalog.py", line 506, in setRecordType
    rstOracle, status = cmdOracle.Execute()
  File "C:\Python22\Lib\site-packages\win32com\gen_py\00000205-0000-0010-8000-00
AA006D2EA4x0x2x5.py", line 1698, in Execute
    return self._ApplyTypes_(0x5, 1, (9, 0), ((16396, 18), (16396, 17), (3, 49))
, 'Execute', '{00000556-0000-0010-8000-00AA006D2EA4}',RecordsAffected, Parameter
s, Options)
  File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 341, in
 _ApplyTypes_
    return self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid, 0, w
Flags, retType, argTypes) + args), user, resultCLSID)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB
 Provider for ODBC Drivers', 'Multiple-step OLE DB operation generated errors. C
heck each OLE DB status value, if available. No work was done.', None, 0, -21472
17887), None)

HERE is an example of what I am doing... (note, I added the long() typecasting
to make sure the value was coerced into a long integer)...

sql = "select pty.orgname " + \
      "from ccc_party pty, ccc_right_rightsholder rgh, ccc_right rgt " + \
      "where pty.pty_inst = rgh.rgh_inst " + \
      "and rgh.rgt_inst = rgt.rgt_inst " + \
      "and rgt.rgt_inst = ?"

cmdOracle.ActiveConnection = cnnOracle
cmdOracle.CommandType = 1
cmdOracle.CommandText = sql

trsInst = long(rstTempDB.Fields("trs_inst").Value)
aasInst = long(rstTempDB.Fields("aas_inst").Value)
anyInst = trsInst or aasInst
        
cmdOracle.Parameters.Append(cmdOracle.CreateParameter("orgname", 200, 2, 80))
cmdOracle.Parameters.Append(cmdOracle.CreateParameter("rgt_inst", 3, 1, 4,
long(anyInst)))
rstOracle, status = cmdOracle.Execute()



More information about the Python-list mailing list