Hi,
I´m working with mySQL over ODBC and Microsoft VC++ 6.0.
I have created a MFC-Application. I have also set the Option 128.
Because there was a Error on Edit and Delete Records, (Invalide Cursor
Name, Data Truncated), i have changed the Update-SQL in the
Recordset-Class as follow:
-I have copy the implementation of this 4 methods from dbcore.cpp in my
own CRecordset-class:
BOOL Update();
void Delete();
BOOL UpdateInsertDelete();
void BuildUpdateSQL();
-I have changed in BuldUpdateSQL this:
//-------- COwnRecordSet.cpp
// Update and Delete need "WHERE CURRENT OF <cursorname>"
if (m_nEditMode == edit || m_nEditMode == noMode)
{
// Cache cursor name assigned by ODBC
if (m_strCursorName.IsEmpty())
{
// Get predefined cursor name from datasource
RETCODE nRetCode;
UCHAR szCursorName[MAX_CURSOR_NAME+1];
SWORD nLength = _countof(szCursorName)-1;
AFX_SQL_SYNC(::SQLGetCursorName(m_hstmt,
szCursorName, _countof(szCursorName), &nLength));
if (!Check(nRetCode))
ThrowDBException(nRetCode);
m_strCursorName = (char*)szCursorName;
}
/*
m_strUpdateSQL += m_strCursorName;
*/
m_strUpdateSQL += _T(" WHERE PKey =' ");
char buffer[20];
_ultoa( m_ID, buffer, 10);
m_strUpdateSQL += m_PKey;
m_strUpdateSQL += " ' AND ID = ' ";
m_strUpdateSQL += buffer;
m_strUpdateSQL += " ' ";
}
//---------------
This works fine now, but the program doesen´t delete the CTTnnnn.TMP
-Files.
Can somebody help me ?
Oli
| Thread |
|---|
| • Changes in Recordset [RE: CTTnnnn.TMP Files in VC++] | Olivier Auer | 19 Apr |