[Gambas-user] Database: Events BeforeSave(...) and BeforeDelete(...)

Gianluigi bagonergi at gmail.com
Mon Jul 15 17:32:09 CEST 2019


Il giorno lun 15 lug 2019 alle ore 08:57 Hans Lehmann <hans at gambas-buch.de>
ha scritto:

> Hello.
>
> For a SQLite database project for our online book - in which all field
> types are used - I would like to insert an image (field type db.Blob) for
> each record. I also want to use the most important control elements from
> the component gb.db.form (DataSource, DataBrowser with navigation bar (New,
> Save, Update, Delete, Forward, Backward, Start and End), DataControl,
> DataCombo).
>
> I would like to implement the following:
>
> (1)
> Before saving a new or changed dataset, it should be determined whether an
> image has already been saved. If this is NOT the case, the image should be
> saved after an image selection dialog.
>
> (2)
> Before deleting a dataset, you should ask whether the dataset should
> actually be deleted. At the moment the data record is deleted immediately
> without any further inquiry!
>
> For both tasks the two events BeforeSave( Data As Result ) and
> BeforeDelete( Keys As Variant[] ) are obvious. But I have no idea how to
> handle both tasks with it? Can anyone help with ideas or even source code?
>
> Yours sincerely
>
> Hans
>
>
Hi Hans,

stimulated by yours and by other questions on the graphic management of
data with the gb.db.form component, I started studying it.
Unfortunately I am stuck at the connection (Connection1.connection) which
is indispensable for quickly compiling through the windows offered by the
component.
When I start the Database with:

Connections["Connection1"].Open

In a Balloon on Debug Common.CHeckDB.34 I get:
Unable to locate database 'DB.gambas3' in '~/database' nel FMain:10

Note: If I open in traditional way it works.

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190715/b18e1c89/attachment.html>


More information about the User mailing list