Subject | MFC CRecordset::Edit throws exception on updates |
---|---|
Author | ritchie72nlnl |
Post date | 2003-12-02T10:45:17Z |
Hello,
I am writing a C++ application which uses the Firebird Database
(v1.0.3).
I'm using the CRecordset class (MFC Library) to manipulate tables. No
problem in adding rows, all works fine, but whenever I try to update
an existing field, the recordset throws an exception. Here is a small
code snippet:
**** Code Snippet ****
CRecordset rst;
rst.m_strFilter = "SomeField = value"; // SomeField is PK or unique
rst.Open();
if (!rst.IsEOF())
{
try
{
rst.Edit();
rst.m_FIELDNAME1 = value;
rst.m_FIELDNAME2 = value;
rst.Update();
}
catch (CDBException *xcp)
{
MessageBox("Error:\n" + xcp->m_strError, "ERROR!");
xcp->Delete();
}
}
else
{
...
}
rst.Close();
**** End of Code Snippet ****
Now when an update occurs, the application will throw error code -
104, Unexpected end of command. Further, after the execution of this
code, when I try to shut down the Guardian, it informs me there is an
Overlapped I/O operation in progress (code 99).
I'm at a loss here, because the same code worked ok with Interbase 7.
Does anybody know the solution to this problem or see what I might be
overlooking?
Thanks in Advance,
Sincerely,
Richard
I am writing a C++ application which uses the Firebird Database
(v1.0.3).
I'm using the CRecordset class (MFC Library) to manipulate tables. No
problem in adding rows, all works fine, but whenever I try to update
an existing field, the recordset throws an exception. Here is a small
code snippet:
**** Code Snippet ****
CRecordset rst;
rst.m_strFilter = "SomeField = value"; // SomeField is PK or unique
rst.Open();
if (!rst.IsEOF())
{
try
{
rst.Edit();
rst.m_FIELDNAME1 = value;
rst.m_FIELDNAME2 = value;
rst.Update();
}
catch (CDBException *xcp)
{
MessageBox("Error:\n" + xcp->m_strError, "ERROR!");
xcp->Delete();
}
}
else
{
...
}
rst.Close();
**** End of Code Snippet ****
Now when an update occurs, the application will throw error code -
104, Unexpected end of command. Further, after the execution of this
code, when I try to shut down the Guardian, it informs me there is an
Overlapped I/O operation in progress (code 99).
I'm at a loss here, because the same code worked ok with Interbase 7.
Does anybody know the solution to this problem or see what I might be
overlooking?
Thanks in Advance,
Sincerely,
Richard