Re: SQL Update: How do I get more error information
- From: Neil B <NeilB@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 24 Jan 2009 14:25:03 -0800
Bob,
Sorry I took so long in responding. Had other priorities to deal with. I'm
back on this problem now.
The data base is a MS Access. The code is an app in C++ thats runs on a PC.
No web code involved.
Below is the main piece of code in question. The AddRecord method does an
update also ( which works fine) just before exit of its method. If the method
below is called to update and existing record it works fine. If its a new
record then it fails. I've trace thru the code and there is no sign of
problem. The bookmark looks good and the GetRecord returns the record to be
updated okay. I have an earlier version that has this same code as well as
the methods that are called. It traced them side by side and one works and
this one fails.
Any ideas?????
Thanks for all your help,
Neil
The server is "Microsoft.Jet.OLEDB.4.0".
The recordset is .....adOpenDynamic, adLockOptimistic, adCmdText.....
***************************************************
//************************************************************************************
void CReporterView::PutRecordToDatabase(int row)
//************************************************************************************
{
CRecord *pRecord, tempRecord;
CAccountDataBindingADO* pRsRecord;
CRecordSet* pAccountRs;
int r=row;
// Record set for Transaction view
if (IsTransactionView())pAccountRs=bDB.GetRecordSet("ItemView");
// Record set for AccountJournalProject view
else pAccountRs=bDB.GetRecordSet("AccountView");
// Write it back to the database - if it was changed
if (m_view[r]->m_dirty)
{
// Get the record
pRecord=m_view[r];
// Add the record to the data base - if it's a new record
if (pRecord->m_newRecord)
{
pRsRecord=(CAccountDataBindingADO*)pAccountRs->GetRecord();
pAccountRs->AddRecord();
pRecord->m_id=pRsRecord->m_id;
pAccountRs->GetBookmark(pRecord->m_bookmark);
pRecord->m_newRecord=false;
}
// Get the record to be updated
pRsRecord=(CAccountDataBindingADO*)pAccountRs->GetRecord(pRecord->m_bookmark);
// Get the record and create a temporary copy of it
tempRecord=*pRecord;
// Swap accounts - if necessary
if (tempRecord.IsSwapped()) tempRecord.SwapPrimaryAndSecondaryAccounts();
// Write to the database
*pRsRecord=tempRecord;
pAccountRs->UpdateRecord();
// Reset the dirty record flag
pRecord->m_dirty=FALSE;
}
}
***************************************************
"Bob Barrows" wrote:
Neil B wrote:.
I got the following error information when updating a record to the
database. The connection error count was only 1. So how do I get more
information about the error so it can be debugged? Where are the
status values?
Thanks, Neil
"Function: CRecordSet::UpdateRecord, RecordSet: AccountView
Error# = -2147217887, Multiple-step operation generated errors.
Check each status value., (Source: Microsoft Cursor Engine), (SQL
State: (null)), Native Error: 0"
Unfortunately, that is the error that ADO reports when it does not know what
to report. I have run into that error many times, and each time it has had a
different cause.
What is this? A server-side cursor? It looks like SQL Server is the
underlying rdbms. What version?
Without information about how to reproduce the error we don't have much
chance of helping you. My first step would be to use SQL Profiler to trace
what's going on when performing the steps to reproduce the problem.
--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
- Follow-Ups:
- Re: SQL Update: How do I get more error information
- From: Bob Barrows
- Re: SQL Update: How do I get more error information
- References:
- SQL Update: How do I get more error information
- From: Neil B
- Re: SQL Update: How do I get more error information
- From: Bob Barrows
- SQL Update: How do I get more error information
- Prev by Date: Re: Losing connection to DB for 10 minutes!
- Next by Date: Re: SQL Update: How do I get more error information
- Previous by thread: Re: SQL Update: How do I get more error information
- Next by thread: Re: SQL Update: How do I get more error information
- Index(es):
Relevant Pages
|