Saturday, March 05, 2005

[Access Driver]Cannot open any more tables

I'm writing this app which reads heavilly from an access 'database'. all goes well, but after a large dataload, the odbc driver began throwing this message at me! how dare you, little woodpecker! ;)
i paniced at first and even began considering whether i should move to ADO.NET (the app is written in c#). i searched and searched the net (Google) and a note in a
message
got me startled - " ...and then close the statement object once the result set query has been accessed..." and this - "..You may also want to close the result set as you say after you are done with it...".
of course i close my datareaders and without this notion, but this constant repeating of "close this, close that" got me an idea - and then suddenly i noticed that OdbcCommand has a Dispose() method. and thats was it! after i close the datareader, now i also dispose of the odbccommand object and everything goes smoothly....

3 comments :

KMB said...

finally i got the best solution.

many thanks you saved my application :)

Terry said...

Thanks Esdee
I have been fighting this problem and searching for a clue how to fix it for several days. The Dispose() method fixed it.

Claire said...

Thanks, worked for me too.