[python-win32] Recovering from AODB Exceptions, possible?
Rex Corrovan
rex555 at hotmail.com
Tue Feb 13 02:44:05 CET 2007
Awesome! CancelUpdate did the trick, thanks.
From: "Roger Upole" <rwupole at msn.com>
To: <python-win32 at python.org>
Subject: [python-win32] Re: Recovering from AODB Exceptions, possible?
Date: Fri, 9 Feb 2007 23:41:50 -0500
Rex Corrovan wrote:
> So I have a function that ries to add a record:
>
> def EntryAdd(self, dataDict):
> try:
> self._DBConn.MoveFirst()
> self._DBConn.AddNew()
> for key, value in dataDict.items():
> self._DBConn.Fields.Item(key).Value = value
> self._DBConn.Update()
> 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.
hth
Roger
_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
_________________________________________________________________
Get in the mood for Valentine's Day. View photos, recipes and more on your
Live.com page.
http://www.live.com/?addTemplate=ValentinesDay&ocid=T001MSN30A0701
More information about the Python-win32
mailing list