Subject "Statement has not been prepared"
Author tickerboo2002
Using BCB v5, FB v1.0, IBO v4.2h. Using Non IBO visual controls

I'm hoping this is a simple one.

I have a query that returns a number of rows (they are tasks - a text
blob) and are then displayed to enable the user to edit them.

When the user edits the text I locate the row in the query and
replace the text. OK, so far. However, if the user doesn't make any
actual changes to the text, I still update the row (see 'Editing a
row' below). In this case, when the form closes and I Post and then
commit any changes I get a messagebox pop up saying "Statement has
not been prepared".

The statement has been prepared because the qry has remained open
throughout the life time of the form, and it works fine if the user
actually changes some text.

What's causing this error if I try to post and commit a row that has
not actually changed? My code is listed below.


TIA

David


FormShow:
qry->Prepare();
qry->ParamByName("USER_ID")->AsInteger = nID;
qry->Open();

while( ! qry->Eof )
{
// Display items
qry->Next();
}

Editing a row:
TIB_LocateOptions lo;
if ( qry->Locate( "USER_TASKS_ID", nTaskId, lo ))
{
qry->FieldByName("NOTES")->Assign( memoNotes );
}

FormClose:
qry->Post();
qry->IB_Transaction->Commit();
qry->Close();
qry->Unprepare();

After I setp over 'qry->Unprepare();' and out of the function, I get
the error message appearing.