Re: Not enough storage is available to process this command




tk72 wrote:
> I have written a DLL in C++/ATL (Visual Studio 6.0) that connects to
> different databases using ADO smart pointers (_ConnectionPtr and
> _RecordsetPtr). I am connecting to one MS Access database among
> others, and it is that connection that gives me a headache. I can call
> the function in this DLL with the same parameters about 1000 times
> before an exception is thrown with the error in the subject. The code
> to open each connection is:
>
> ******** CODE *********
>
> bool CPE::OpenConnection(int connIndx)
> {
> HRESULT hr = S_OK;
> try
> {
> if(m_connArr[connIndx] == NULL)
> {
> hr = m_connArr[connIndx].CreateInstance(__uuidof(Connection));
> if(hr != S_OK)
> {
> return false;
> }
> }
>
> if(hr == S_OK && m_connArr[connIndx]->State != adStateOpen)
> {
> m_connArr[connIndx]->CursorLocation = adUseClient;
> hr = m_connArr[connIndx]->Open(m_connStrArr[connIndx], "", "",
> -1);
> if(hr != S_OK)
> {
> return false;
> }
> }
> }
> catch(_com_error &err)
> {
> return false;
> }
> return true;
> }
>
> ******** CODE *********
>
> The connIndex is an index into both an array of _ConnectionPtr
> (m_connArr) objects and an array of _bstr_t:s (m_connStrArr) that holds
> the connections strings for the corresponding connection. The call to
> open the recordset goes like:
>
> ******** CODE *********
>
> if(pRs == NULL)
> {
> hr = pRs.CreateInstance(__uuidof(Recordset));
> }
>
> pRs->CursorLocation = adUseClient;
>
> pRs->Open(sql, m_connArr[ConnIndex].GetInterfacePtr(), adOpenStatic,
> adLockOptimistic, -1);
>
> pRs->putref_ActiveConnection(NULL);
>
> ******** CODE *********
>
> Both sql and ConnIndex are parameters to the function where this call
> is made from.
>
> Can anyone see anything wrong in this code, or at least have any ideas
> how to go about tracking down the problem further? I have debug code
> that logs all open and close of the recordsets and connections, and
> they do match after each call to the DLL. I am only opening/closing
> each of the connections once during the lifetime of the DLL. Does a
> connection have a "life span", so I need to close it and re-open it
> once in a while. One obvious problem would be that there isn't enough
> disk space or memory, but there are plenty of both, so I don't think
> that is it.
>
> Any help would be much appreciated,
>
> TK

I forgot to point out that the error occurs on the line where the
recordset is opened.

Thanks,

TK

.



Relevant Pages

  • Re: Updating Access data using SQL / refresh time question
    ... As a test today, for one poarticular recordset, I changed from DAO to ADO to ... > I forgot to mention that the expense of repeated connection open and close ... > dim oconn as new adodb.connection ... > 'Now load the listview by looping through each RS row ...
    (microsoft.public.vb.database)
  • Re: Updating Access data using SQL / refresh time question
    ... > I forgot to mention that the expense of repeated connection open and close ... > dim oconn as new adodb.connection ... > 'Now load the listview by looping through each RS row ... > ' Set the recordset object each time we load the listview ...
    (microsoft.public.vb.database)
  • Re: Problem: MDB-Datenbank Zugriff über das Intranet
    ... Wie und wo öffnest Du Deine Connection zur *.mdb? ... > End With ... Du öffnest ein Recordset mit adOpenForwardOnly. ... Datensatz liegenden Datensatz zuzugreifen. ...
    (microsoft.public.de.vb.datenbank)
  • Re: ASP - FROM statement slows down connection to database
    ... Open your database in Access, switch to the Queries tab, create a new query ... in Design View without choosing a table, swtich to SQL View, paste the sql ... connection string rather than using an ... recordset open statements. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Can Not Create Control
    ... > Private Sub Form_Load ... > Dim laco As Connection ... > Dim lars As Recordset ...
    (microsoft.public.pocketpc.developer)