Zabber
Zabber

Reputation: 1

Updating Image in SQL (Delphi 7)

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 ?

Upvotes: 0

Views: 623

Answers (1)

Graymatter
Graymatter

Reputation: 6587

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].

Upvotes: 2

Related Questions