Question : Transaction problem

This is Access 2007 Stock System with a SQLServer 2005 backend.I have a routine which does multiple postings into the stock system. I've dubegged it and got it working. So I decided to make it all more robust by using a transaction which could be rolled back if a problem occurs.

Shortly after doing the .BeginTrans I open 2 ADODB recordsets. I'm finding that an error now occurs as the second recordset is opened. I swapped my code around so that the second recordset is opened first. So now the error occurs when it tries to open the other recordset. In other words, the error occurs on whichever recordset is opened second. The error returned is -2147467259

I could re-write my code so that recordsets are not opened during a transaction, but I would prefer to be able to leave my code as it is.

Why can I open one recordset succesfully and then have an error on the second?

Answer : Transaction problem

Using the code in the related post, consider what happens when adjacent_find sends left=(22,A) and right=(22,A) to isDistEqual(). The distances match, but the student ID do not match and so
       left.studentName != right.studentName
is false. So this pair is skipped by adjacent_find.

So, you won't even know from adjacent_find that there even were two entries = (22,A). So, you don't have to worry about getting 22 feet: A, A, C, D since 22,A will be seen only once.
Random Solutions  
 
programming4us programming4us