The column in the database that should hold the .bmp image is named pscreen and is set as a

mediumblob

type.

Problems:

When I click the

Cancel

button on the form, it does not close, basically does nothing.

When I click the

Salveaza

button on my form, it does nothing.

Things I've tried:

I've tried adding the

close;

and

modalresult:=mrok;

but it doesn't seem to execute the code for the image, just makes the Save button work and closes the form but no image added to the db field

Searched for tutorials on this, found a bunch but either they're not for what I need or I clearly don't understand how to overcome this and get it to work

I'm new to Delphi/SQL so I'm mostly working with tutorials from the net, answered question from the community here and various such resources, so clearly I must be doing a simple mistake somewhere due to me being new.

I've been at it for a couple of days now and cant seem to get this to work, to make those 2 buttons work (Cancel and Salveaza) and once I click the Salveaza button to run that code and see if it works.

I'd appreciate any insight, guidance you might have to share on this, perhaps you can notice something wrong I'm doing so far and can help me finish this functionality as it's giving me quite the headache, lol. Code examples using my already provided info would be more appreciated, if you have the time and desire, as it would speed things up and help to understand better and faster the whole process.

I'm using Rad Studio 10 Seattle, the database is

MYSQL

, the database components are located on a data module named dbmodule and contain the following:

TSimpleDataSet

,

TSQLQuery

,

TDataSource

,

TSQLConnection

- they are

dbExpress

components.

Sorry for the long post but I wanted to be as clear as possible in my explanation, hope I didn't leave anything out - leave a comment if so and I will edit.

Edit

Your indentation suggests that Image1 will attempt to load only if dlg executes successfully. This is not the case. It will always attempt to load. Your code should be
if dlg.Execute(Handle) then
begin
selectedFile := dlg.FileName;
Image1.Picture.LoadFromFile(selectedFile);
end;