Forum > Databases

[solved] SQL - IBX - "returning" - primary key

<< < (6/6)

rvk:

--- Quote from: Nicole on December 09, 2022, 03:15:23 pm ---
--- Quote ---You can write a complete edit-form without any code. (This as been discussed before). Are you familiar with the data-aware edits (TDBxxx)??
--- End quote ---
WHAT?!
This sounds extremely thrilling.
I have not idea of the thinks you asked me if I "am familiar with".
--- End quote ---
The question is "do you know about the TDBxxx components"?
Those are data-aware and automatically connected to a datasource, the same way your TDBGrid gets it data from a TIBQuery.
That way you don't have to keep doing Edit1.Text := IBQuery1.FieldByName('FIELD').asString.
TDBEdit gets the text automatically and when you change the text, it also gets put in the database via the UPDATE SQL's.

I have made a small example. You can put it in a directory, compile and just run it.
It automatically creates a database (without the need for FlameRobin) when there is none (that's most of the code  :D).
It show a TDBGrid with records. You can edit the records with the DBNavigator (pencil icon) and directly change the Edit's below the form.

The CreateDatabase is actually standalone code, it uses it's own TIBDatabase and TIBXScript etc to create the database.
No connection to anything. So you can just use/copy it in any program where you need a database created.
(also examine how I create TIBXScript etc in code without the need to drop one on a form)

It also has another option of a separate form. When you select a button and click the big button on the right, you get a separate form for editing.
Because that form has it's own TIBQuery you can even open multiple form-editors at the same time (just try it).

Most of the code in this example is to create the database and to sync the editform when changes are made.
I also do a lot of setup in code and you can't connect in the IDE (because the database might not exists yet).
(I usually do everything in code to have more control over everything. The fact I can't design in the IDE isn't a problem for me.)

Absolutely no Edit1.Text := IBQuery1.FieldByName('FIELD').AsString is done anywhere.
(that's what I wanted you to see when working with TDBEdit, TDBMemo etc, the dataware edit components)

Just look at the example and try to discover and imagine the upside of using the TDBEdit etc components more.

Nicole:
Thank you so very much!
I downloaded it and cross fingers, it will bring it to run.
I'll report.

egsuh:

--- Quote ---- send a software-generated-query to a table
- have the results there and edit it directly into the db
--- End quote ---

Try TIBDataSet for that purpose.

Navigation

[0] Message Index

[*] Previous page

Go to full version