Subject Re: [IBO] TIBOQuery posting error
Author Geoff Worboys
> I'm using the code appearing below to update a FireBird table
> via an IntraWeb application:

I've never used IntraWeb so please excuse me if my comments are
out of place...

> if UserSession.IBOPhotoAlbum.State = dsInsert then

This line seems strange...

if IBOPhotoAlbum is a dataset (can be in dsInsert) then why
would you want to check it was insert state when you are
about to close it anyway?

if IBOPhotoAlbum is a dataset then...

> begin
> with UserSession.IBOPhotoAlbum do
> begin
> Close;
> SQL.Clear;
> SQL.Add('Insert into PhotoAlbum (Description, LoadedPhoto)');
> SQL.Add('Values (:Description, :LoadedPhoto)');
> ParamByName('Description').AsString := edtDescription.text;
> ParamByName('LoadedPhoto').LoadFromStream (, ftGraphic);
> Open;
> end;
> end;

...should not have its SQL set to a non-query statement.

The statement you have defined to the SQL is an insert and
this will not define any fields - a dataset must define some
fields and return zero or more rows of those fields. An
insert statement does neither.

It seems to me that...

IBOPhotoAlbum is not a dataset, in which case some of the
code above (checking for insert state) does not make sense.


IBOPhotoAlbum is a dataset in which case you will need to
do one of:

- having found IBOPhotoAlbum in insert state, and assuming
it has description and loadedphoto fields then use:
FieldByName('Description').AsString := edtDescription.Text;
without closing or changing the dataset in any other way.

- create a separate IB_DSQL to perform the insert as you
have it above, and then optionally refresh the
IBOPhotoAlbum dataset to pickup the new row.

Geoff Worboys
Telesis Computing