0

Using the Parameters in a Query, I can store and retreive imagaes to and from a MySQL database. I do this, like :

Query.SQL.Text := 'Insert into TABLE (ID,PICTURE) Values (:ID, :PICTURE)';
Query.Parameters[0].Value := '1';
Query.Parameters[1].Assign(Picture);
Query.ExecSQL;

In this case Picture is a TImage.

Now, I would like to change the image in the table by a new image.

I can't find a way to do this like I did above. Something like :

Query.SQL.Text := 'UPDATE TABLE SET (ID,PICTURE) Values (:ID, :PICTURE)';
Query.Parameters[0].Value := '1';
Query.Parameters[1].Assign(NEWPicture);
Query.ExecSQL;

Is there a way to do this like so? Or does somebody knows an other way ?

1 Answer 1

2

Your query should be something like:

Query.SQL.Text := 'UPDATE TABLE SET PICTURE = :PICTURE WHERE ID = :ID';

Obviously your parameters would then be switched around with the blob being [0] and the ID being [1].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.