Hi all,
I've been working on this project to convert this VB6 Access DB project to .NET. Things are going OK except I have run into persistent dao cannot open any more databases error.
I have diligently tracked down every openrecordset/db connection to close them down and set to nothing after use, but it still pop out upon large number of queries. Could anyone please give some pointers as to what to do next?
I begin to suspect whether the recordset.close truly close the connection etc or is it that's an intrinsic trait of Microsoft Access cannot handle repeated open/close etc (I think I read somewhere that is the case and microsoft said it is by design...)
Anyway, looking forward to some helpful hints,
T
Thanks for the explanation.
I've resolved the problem. Here is what happened:
I have this function that would open a recordset like the following (to a MDB) at the beginning of a function (which gets called numerous times repeatedly):
fldRec = stateDB.OpenRecordset(Me.Y
fldRec.MoveLast()
fldRec.MoveFirst()
Then there are a bunch of complicated actions taken through many conditional branches. I closed the recordset at the very end of the function, however, there are Return(s) somewhere midway in the function that I didn't catch, hence, whenever it reaches the end of the function, the recordset is closed, if not, then that connection is still open, hence the problem.
I think recordset.Close() would indeed close the actual connection in the dao world, so this means, you can have a persistent MDB handle (through OpenDatabase call), but it is the OpenRecordset that is opening the connection, which needs to be closed after each use.
I would assign partial points for your prompt response and clear explanation, but not sure how to do that though...
Thanks
T