
CRecordset - access violations
I have an CRecordset (MFC 4.2) that contains a date column. After adding
the first new record, but before returning from rs.Update(), I get an access
violation in the RFX_Date() / DoFieldExchange() functions. I've traced
through this and discovered it happens during the CrecordSet:::LoadData()
call. I tried wrapping this with TRY/CATCH but to no avail. Needless to
say, the program terminates, leaving any further data unposted.
If I crank up Access and look at the table, it's fine. I've noticed that
DoFieldExchange is called 3 times during AddNew and 4 times on Update() -
it's this 4th time that hoses my program.
Now before someone says, use CDaoRecordset, let me tell you why not. These
record sets are common code that 's used for multiple db sources (Access and
SQL Server) and I'd rather not incur the overhead of DAO when using SQL
Server. I'm not sure that DAO would solve it anyway.
Anyone else encountered this problem?
Thanks
Chuck