Subject Re: [IBO] cannot insert new row setup
Author Lucas Franzen

> I do not know which query the error is coming from. I do the same for

Why don't you simply set a breakpoint within this code and find out
which one it is?
- or you the try..except block I've added in the code?

> all my queries(maybe it's wrong) there is 23 of them, sorry for the
> english
> let me try and explain a typical setup for each query.

> this routine should open all my queries.
> begin
> for i := 0 to ComponentCount-1 do
> begin
> if Components[i] is TIBOQuery then
> begin
> with Components[i] as TIBOQuery do
> begin
// if your qry is already in Insert/Edit mode
// this will help
if State in [dssInsert, dssEdit] then Cancel;
// although this is NO sultion, just for excluding certain
// error causes

> Active := False;
> IB_Connection := TireServer;
> PessimisticLocking := False;
> // BufferSynchroFlags := [bsAfterEdit];
> RequestLive := True;
> ReadOnly := false;
> FetchWholeRows := True;
> CachedUpdates := False;
> AutoFetchAll := True; // False;
> KeyLinksAutoDefine := False;
> // MaxRows := 0;
> ParamCheck := True; //ver much required for
> Mast/Detail

if sql.text <> '' then // you know that a single empty line
// will evaluate true, too ;-)
Prepare; // you should definitely prepare a statement!
Open; // Opening will check if Active anyway.
ShowMessage ( 'Problem with Query: ' + Name );

> This is what I do for all my queries, how can I debug this and find
> out which table is giving me the error' cannot insert new row'?

"Cannot insert new row" will happen as you try to Execute an insert
Are you sure none of these queries in in Insert or Edit mode and/or will
be put into insert mode in any event of the queries?

I think CanInsert in IBO will just check if all requirements for a live
query will be met, otherwise evaluate false.

Another problem might be that your query is bound to a ReadOnly
transaction (though I'm not sure if there will be an error when put into
insert mode).