Subject Re: [IBO] Delete SQL
Author Helen Borrie
At 12:24 PM 24-10-01 +0200, you wrote:
>After modifying Tutorial1 (yes that's where I am now), I am confused as to
>how to eliminate the 'cannot delete current row' error.
>The first part of the following code works just fine. It's when I try to
>execute the delete then the error occurs.
>I apologise for the simplistic problem as I have been out of the
>BDE/Interbase for quite a while.

That's OK. Welcome back. :)

It's a great idea to proceed to modify the tutorial with you own experiments. Still, it helps to know one or two of the basic spells which IBO has cast for you in TIB_Query.

For now, ignore the properties InsertSQL, EditSQL and DeleteSQL. They are there for "special cases".

This will get you started.

Drop an IB_Query on the form. Set its IB_Connection property to the connection that is on the Tutorial1 form.

Double-click on the ib_query to bring up the editor (you'll be dazzled by the stuff that's there but - worry not - you don't need most of it for your early experiments.

Place a simple SELECT statement into the SQL pane. (You can play about with the tables and fields on the left and see how the editor helps you with the SQL. Then click the lightbulb button to prepare the query and the book button to open it. If you click the 'End' button (>|) on the navigation bar you will see the whole dataset.)

set the Keylinks property by typing in the name of the primary key of the underlying table.

If the primary key is populated by a generator, set the GeneratorLinks to the name of the generator.

Click OK.

The rest is magic. Set the query's RequestLive property to True. Use an ib_datasource to link your dataset to some controls. Enter some code to open the query.

Inserts, edits and deletes will be automatic when you invoke the query's Insert, Edit and Delete methods (you can do that from buttons or drop a TIB_UpdateBar on and connect it to the query's datasource, thus avoiding writing button handlers).

That's a little tiny bit of what's in there but it should get you going. Do work your way through the tutorials cuz they will feed you with pieces bit by bit.


All for Open and Open for All
InterBase Developer Initiative ยท