ADO: Object was open



Numerous web searches indicate that this is an old prob: I was having
trouble using ADO and getting "object was open" errors.

FWIW, and in case this bug bedevils others in the future, I eventually
found a solution in my own case by setting my ADO's Command->Name
property to a unique value for each sql stmt that I use. Apparently in
some way my ADO needs this in order to function reliably.

Also fwiw, merely setting the Name property then *also* crashed my pgm
- it was really just not my day, I guess - until I set the property by
using a technique of first copying the unique name value to a _bstr_t,
then using an assignment of the form Command-
Name.Assign(_bstr_t.GetBSTR());

Hope this helps anyone else who trips over the prob. Took me longer
than I care to admit to get this far, and if anyone else ever posted
the above approach, I never did see it.
.



Relevant Pages

  • Re: Object was open
    ... FWIW, and in case this bug bedevils others in the future, I eventually ... some way my ADO needs this in order to function reliably. ... This email account is my spam trap so I ...
    (microsoft.public.data.ado)
  • Re: Using Querytable.add to import data from a closed workbook
    ... >> FWIW one can get the worksheet names from a closed workbook using ADO ...
    (microsoft.public.excel.programming)
  • Re: fgw bad news for all
    ... prob said too much already, it IS from a very secure source and well ... FWIW this ng has a good reputation in stirring up the 'correct' hornets ... nest, hence the post. ...
    (uk.railway)