[python-win32] Re: Recovering from AODB Exceptions, possible?
rwupole at msn.com
Sat Feb 10 05:41:50 CET 2007
Rex Corrovan wrote:
> So I have a function that ries to add a record:
> def EntryAdd(self, dataDict):
> for key, value in dataDict.items():
> self._DBConn.Fields.Item(key).Value = value
> except pywintypes.com_error, e:
> print e
> print 'error text here'
> return True
> So if the error already exists I get an exception, no problem, I handle and
> log it.
> The problem here is that anything I now try to use this recordset for will
> throw an exception. Is there any way to recover from this without recreating
> the whole recordset?
It's kind of hard to tell without a traceback, but at a guess
it looks like the offending record created with AddNew is
never removed from the recordset after the error occurs.
CancelUpdate() should get rid of it.
More information about the Python-win32