Re: Stack Overflow on Insert

Jeff Nygren <[email protected]> Fri, 24 May 2002 09:08:52 -0500
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <[email protected]>
Hi, Kim,

Yes and yes.  ;-)  Is there an issue with the ATL conversion macros?

Thank you for taking a look at this. Here are the 'guts' of my sample app.

Jeff Nygren


   hr = DBOutputCommand.CreateAccessor(nOutputCols, &pszColumnBuf[1],
sizeof(TCHAR)*nOutputCols*256);
      // (I skipped pszColumnBuf[0] just so index matches column ordinal.
Yes I allocated an extra array element.)
   for (ULONG lCol = 1; lCol <= nOutputCols; lCol++)
      DBOutputCommand.AddBindEntry(lCol, DBTYPE_WSTR, 256,
&pszColumnBuf[lCol]);

   hr = DBOutputCommand.Open(m_DBOutputSession, sQuery, &PropertySet);

   // Loop through records
   for (nRecordNum = 0; nRecordNum < NUMROWS; nRecordNum++)
   {
      // Loop through columns of output database
      for (int iColumn = 0; iColumn < NUMCOLS; iColumn++)
         wcsncpy((WCHAR*)pszColumnBuf[iColumn + 1],
(WCHAR*)T2OLE(strValue), 128);

      if (S_OK == (hr = DBOutputCommand.Insert()))
      {
         m_nRecordCount = nRecordNum+1;
         UpdateData(FALSE);
         YieldCPU();
      }
   }  // End of input record loop




Hi Jeff,

Are you using any of the ATL conversion macros in the loop? W2A, A2W, etc?

Could you post the code for LoadAccessorBuffers?

Best regards,
Kim
-----Original Message-----
From: Jeff Nygren [mailto:[email protected]]
Sent: den 23 maj 2002 18:50
To: [email protected]
Subject: Re: Stack Overflow on Insert

I don't think so, the code is pretty simple and straight-forward.

Jeff Nygren


Is there any possibility of a recursive loop going on?

-----Original Message-----
From: Jeff Nygren [mailto:[email protected]]
Sent: 23 05 2002 15:50
To: [email protected]
Subject: [OLEDB_DEV] Stack Overflow on Insert

I have some code that adds records to a MS Access database. If I try to
add too many records, I get a stack overflow. I'm guessing there is
something more I need to do, but I don't know what it is. My code is
basically:

...

You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.