How to save an image as binary ?
How to save an image as binary ?
I would like to save an image as binary, i tried but it doesn't work! How can i do that ? Thank you.
You can use the following construction to insert an image in the table.
In this example, the "Picture" field is has the IMAGE data type.
Code: Select all
...
var
BlobField: TBlobField;
begin
MSQuery1.Insert;
BlobField := MSQuery1.FieldByName('Picture') as TBlobField;
BlobField.LoadFromFile('D:\Image.bmp');
MSQuery1.Post;
end;
-
- Posts: 1
- Joined: Wed 08 Sep 2010 14:24
adding images to blobfield
This code works with the insert
But what if i want to edit and exsisting record
I get an EMSError "incorrect syntax near the keyword 'group'
WHY ???
Thanks
Code: Select all
MSQuery1.insert;
BlobField := MSQuery1.FieldByName('Picture') as TBlobField;
if getpic.Execute then
BlobField.LoadFromFile(getpic.filename);
MSQuery1.Post;
Code: Select all
MSQuery1.edit;
BlobField := MSQuery1.FieldByName('Picture') as TBlobField;
if getpic.Execute then
BlobField.LoadFromFile(getpic.filename);
MSQuery1.Post;
WHY ???
Thanks
Hello,
I could not reproduce the problem. Please, specify the SQL code that you are using in the MSQuery1.SQL and MSQuery1.SQLUpdate properties, and the exact place of the error appearance.
Note that the text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
I could not reproduce the problem. Please, specify the SQL code that you are using in the MSQuery1.SQL and MSQuery1.SQLUpdate properties, and the exact place of the error appearance.
Note that the text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.