Subject Re: [IBO] Cannot insert new records after changing the where clause
Author Svein Erling Tysvær
>Working with IBO 5.2 and Firebird 2.52, I am facing a weird problem.
>I have a very simple TIB_Query w/o any foreign keys, lookups or such, after starting the application I can insert into the table w/o a problem.
>Now, as soon as I modifiy the query by adding a where clause, the insert does not work anymore, giving a primary key error upon posting the new entry.
>Even when I revert back to the original query, the problem remains the same.
>Using the monitor to look at the statement sent to the server, I can see that all the fields are NULL instead of the new values, except the ID field, this is 0,
>although I can see in the connected data field that a new primary key was received from the server.
>What can possibly break the query when only changing its where clause?

If it had been the WHERE clause, Florian, then things ought to have started working again when you reverted to the original query. What I have experienced a couple of times (although it is quite a long time since last time) is that something simple simply doesn't work. Most often, I'm the reason, I find my error and correct it, other times I give up looking for the error and simply add a new component, copy my SQL statement, see the new component working and simply delete the original - i.e. problem solved without finding the error.

The simplest thing to check would be to ascertain that your connected data field actually points to a field in your troublesome TIB_Query and that you're not somehow looking at two different statements. It would explain your findings if it was a stray TIB_Query (e.g. a TIB_Query without a TIB_Connection that you haven't even tried to prepare or open before the insert) that you tried to insert through.

If you still cannot solve your problem, I suggest providing some code to this list.