use this function to retrieve the errors (pass the HRESULT returned after you called Insert() method) and post it here:
CString GetDatabaseError( HRESULT hrErr )
{
CDBErrorInfo ErrorInfo;
ULONG cRecords;
HRESULT hr;
ULONG i;
CComBSTR bstrDesc, bstrHelpFile, bstrSource;
GUID guid;
DWORD dwHelpContext;
WCHAR wszGuid[40];
CString strError;
if (hrErr != S_OK)
{
strError.Format(_T("OLE DB Error: 0x%x\n"), hrErr);
}
LCID lcLocale = GetSystemDefaultLCID();
hr = ErrorInfo.GetErrorRecords(&cRecords);
if (FAILED(hr) && ErrorInfo.m_spErrorInfo == NULL)
{
strError += _T("No Error Information found");
}
else
{
for (i = 0; i < cRecords; i++)
{
hr = ErrorInfo.GetAllErrorInfo(i, lcLocale, &bstrDesc, &bstrSource, &guid,
&dwHelpContext, &bstrHelpFile);
if (FAILED(hr))
{
TRACE(atlTraceDBClient, 0,
_T("OLE DB Error Record dump retrieval failed: hr = 0x%x\n"), hr);
return strError;
}
StringFromGUID2(guid, wszGuid, sizeof(wszGuid) / sizeof(WCHAR));
CString strInfo;
#ifdef _DEBUG
strInfo.Format(_T("Row #: %4d Source: \"%s\" Description: \"%s\" Help File: \"%s\" Help Context: %4d GUID: %s\n"),
i, static_cast<tchar*>(COLE2T(bstrSource)), static_cast<tchar*>(COLE2T(bstrDesc)), static_cast<tchar*>(COLE2T(bstrHelpFile)), dwHelpContext, static_cast<tchar*>(COLE2T(wszGuid)));
#else
strInfo.Format(_T("(%4d) Description: \"%s\"\n"), i, static_cast<tchar*>(COLE2T(bstrDesc)));
#endif
strError += strInfo;
bstrSource.Empty();
bstrDesc.Empty();
bstrHelpFile.Empty();
}
TRACE(_T("OLE DB Error Record dump end\n"));
}
return strError;
}