Subject Re: EIB_DatasetError: Dataset to update not found
Author patrick_marten

thanks for your reply.

First I didn't have a WHERE clause in that update statement (forgott it in the first palce as it was a quick attempt to try it out and I had one only dataset anyway), but when I noticed, that it was missing, I've added it

IBOQuery2.SQL.Add('update <table with error set myCurrentFieldName = :myCurrentFieldName');
IBOQuery2.SQL.Add('where ID = ' + IntToStr(IBOQuery1.FieldByName('ID').AsInteger));
IBOQuery2.ParamByName(myCurrentFieldName).LoadFromFile(<blob_content_file>, ftBlob);

And it works without any problems.

--- In, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
> > I have a routine where I'm going through several tables, look for certain fields, change their content / value via a DB-aware control and post the changes.
> >
> > There is one table where this fails, although several tables before and afterwards work fine.
> >
> > With this table I'm getting an DatasetError with the message (translated) "Dataset to update not found".
> ...
> >The only way seems to be the usage of another query and an update statement...
> >The same block as in the first message, but with this change in the middle:
> ...
> >IBOQuery2.Close;
> >IBOQuery2.SQL.Clear;
> >IBOQuery2.SQL.Add('update <table with error set myCurrentFieldName = :myCurrentFieldName');
> >IBOQuery2.ParamByName(myCurrentFieldName).LoadFromFile(<blob_content_file>, ftBlob);
> >IBOQuery2.ExecSQL;
> ...
> >This works apparently, but the error with the other way doesn't cause a good feeling, so a fix would still be good.
> Don't you have a WHERE clause in this UPDATE statement? I would expect IBO to try to build an UPDATE statement with a WHERE clause when you try to edit and that this somehow fails. Though I've no clue why it fails.
> Set