myoledb insert problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello to all,
I have a problem in inserting a lot of new rows in a MySQL database.
The program selects rows from a table and insert its into another
table.
I'm using myoledb3.0 and I can insert only 3900 rows into the new
table;
after this an error occurred (the sql code is correct, it seems a
memory
problem due to myoledb provider)
I also tried to installa myoledb3.6 and myoledb3.9 but I have an error
in opening connection to db (using a correct connection string)

Can anyone help me?
Thank you in advance.
Luca Coliva


int nColumns = 12;
CCommand<CManualAccessor> cmdSelect;
CCommand<CDynamicAccessor, CRowset> cmdInsert;

MYBIND * pBind = NULL;
pBind = new MYBIND [nColumns];
cmdSelect.CreateAccessor (nColumns, pBind, sizeof (MYBIND) *
nColumns);

while (pRS->MoveNext () == S_OK) //scorro le righe
{
CString csSqlHeader = _T("INSERT INTO ") + csDBTableNameDst + _T("
VALUES (");
CString csSqlBody; //conterrà i valori da inserire
CString csSqlTrailer = _T(")");
for (int i = 0; i < nColumns; i++) //for each row
{
if (pBind [i].dwStatus == DBSTATUS_S_ISNULL) //controllo se il
valore e' NULL
{
_tcscpy (pBind [i].szValue, _T(""));
csElement = pBind [i].szValue;
}
if (i == 0) //first column = dateTime
{
oleDate.m_dt = pBind [i].dblDate;
CString csTmp = oleDate.Format(_T("%d/%m/%y %H:%M:%S"));
csSqlBody = FormatDateForSQL(oleDate, DBTypeDst, TRUE) + _T(",
");
}
else
{
if (i == nColumns-1) //ho l'ultima colonna e quindi non metto la
virgola
csSqlBody = csSqlBody + _T("'") + CString(pBind[i].szValue) +
_T("'");
else
csSqlBody = csSqlBody + _T("'") + CString(pBind[i].szValue) +
_T("', ");
}
hr = cmdInsert.Open (SessionDst,
csSqlHeader + csSqlBody + csSqlTrailer,
NULL,
NULL,
DBGUID_SQL,
FALSE);
if (hr != S_OK)
{
SessionSrc.Close();
SessionDst.Commit();
SessionDst.Close();
delete pBind;
pBind = NULL;
return FALSE;
}

.